0

几天前刚开始学习yii框架,所以我对它完全陌生。问题是在我添加复选框CGridView时出现以下错误:

Property "File.select" is not defined Yii Framework

以下是我的代码:

<?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}',
        )
    )
));
?>

当我删除复选框数组时,它工作正常。我哪里错了?

谢谢。

4

1 回答 1

3

您还可以使用 CCheckBoxColumn 类,如图所示

 'columns'=>array(
        array(
            'id'=>'selectedCompanies',
            'class'=>'CCheckBoxColumn',
         ),

显示复选框

于 2013-06-27T04:24:33.837 回答