Hey guys …
i have problem when using CCheckBoxColumn in CGridView …
i want check item if a variable is in array … it work when i code like this
<?php
$this->widget(‘zii.widgets.grid.CGridView’, array(
'id'=>'content-grid',
'dataProvider'=>$model->search(),
'columns'=>array(
array(
'id'=>'idx',
'class'=>'CCheckBoxColumn',
'selectableRows' => '50',
'checked'=>'in_array($data->id,array(22,23))' ,
),
'nama',
),
));
?>
but when i use array variabel $arr = array(22,23) … it’s failed … my coding below is not working
<?php
$arr = array(22,23);
$this->widget(‘zii.widgets.grid.CGridView’, array(
'id'=>'content-grid',
'dataProvider'=>$model->search(),
'columns'=>array(
array(
'id'=>'idx',
'class'=>'CCheckBoxColumn',
'selectableRows' => '50',
'checked'=>'in_array($data->id,$arr)' ,
),
'nama',
),
));
?>
can someone help me … thanks