Hello all !
I want to build a view where the user can check/uncheck a CCheckBoxColumn in a CGridView, just to indicate whether one contact is in an distribution list (email list) or not. This is a 1-to-Many relationship between the following two tables:
[font="Courier New"]List
[/font][font="Courier New"]-----------------------
List_name varchar(20)
contact_id int(10)
Contact
[/font][font="Courier New"]-----------------------
id int(10)
title varchar(4)
givenname varchar(25)
familyname varchar(25)
[/font]
One contact can be in many distribution lists.
The CGridView is to show all the existent contacts of the selected email list. If it is a new list then the CGridView will show all CCheckBoxColumn unchecked, but if not, then the contacts that belong to that email list must show the CCheckBoxColumn checked.
1787
I need a PHP expression or something to add it to my CGridView widget, in order to check whether for each row in the Contact table is there a corresponding row in the List table.
Such PHP expression would be for the CCheckBoxColumn->check property.
$this->widget('zii.widgets.grid.CGridView',
array(
'id'=>'contact-grid',
'dataProvider'=>$contactModel,
'filter'=>$contactModel,
'enableSorting'=>true,
'summaryText' => '{count} record(s) found.',
'selectableRows'=>2,
'columns'=>array(
array(
'class'=>'CCheckBoxColumn',
'checked'=>'false' // The PHP expression would go here !
),
'title',
'givenname',
'familyname',
)
)
);
Any tip or idea on how to make this happen?