Just started to learning the yii framework couple of days ago, so I am totally new in it. The issue is while adding checkbox in my CGridView
I am getting the following error:
Property "File.select" is not defined Yii Framework
and following is my code:
<?php
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider' => $model->search(),
'filter' => $model,
'columns' =>
array(
array(
'name' => 'select',
'value' => 'CHtml::checkBox("cid[]",null,array("value"=>$data->id","id"=>"cid_".$data->code))',
'type' => 'raw',
'htmlOptions' => array('width' => 5),
//'visible'=>false,
),
array(
'name' => 'name',
'value' => 'CHtml::link($data->name, array("file/download", "code" => $data->code))',
'type' => 'html'
),
array(
'name' => 'createdAt',
'value' => '$data->createdAt',
),
array(
'class' => 'CButtonColumn',
'updateButtonUrl' => 'CHtml::normalizeUrl(array("file/update", "code" => $data->code))',
'deleteButtonUrl' => 'CHtml::normalizeUrl(array("file/delete", "code" => $data->code, "deleteCode" => $data->getDeleteCode()))',
'template' => '{update} {delete}',
)
)
));
?>
When I remove checkbox array its working fine. Where I am going wrong?
Thanks.
You Can also make use of class CCheckBoxColumn as shown
'columns'=>array(
array(
'id'=>'selectedCompanies',
'class'=>'CCheckBoxColumn',
),
To display the checkboxes