2

我想在 yii 上逐行向 gridview 添加单个单选按钮。我在谷歌上搜索这个“yii 单个单选按钮到 cgridview”,但我无法得到我想要的。

这是我的网格视图

<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'acc-recei-grid',
'dataProvider'=>$model->search_implementerlist(),
'filter'=>$model,
'columns'=>array(
    array(
        'class' => 'CCheckBoxColumn',
        'selectableRows' => 2,
        'checkBoxHtmlOptions' => array(
            'name' => 'implementers[]',
        ),
        'value'=>'$data->id',           
        'checked'=>function($data, $row) use ($current_implementers){
            return in_array($data->id, $current_implementers);
        }               
     ),
     array(
            'name'=>'lead_implementer',
            'type'=>'raw',
            'value' => 'CHtml::radioButtonList("lead_implementer","'. $lead_implementer .'",array($data->id), array("template" => "{input}", "style" => "width:20px!important", "separator"=>" "))',

            ),

    'username',

),

)); ?>

我能怎么做?

4

1 回答 1

0
<?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'acc-recei-grid',
    'dataProvider'=>$model->search_implementerlist(),
    'filter'=>$model,
    'columns'=>array(
        array(
            'class' => 'CCheckBoxColumn',
            'selectableRows' => 2,
            'checkBoxHtmlOptions' => array(
                'name' => 'implementers[]',
            ),
            'value'=>'$data->id',           
            'checked'=>function($data, $row) use ($current_implementers){
                return in_array($data->id, $current_implementers);
            }               
         ),
         array(
                'name'=>'lead_implementer',
                'type'=>'raw',
                'value' => 'CHtml::radioButtonList("lead_implementer","'. $lead_implementer .'",array("$data->id"=>"$data->id"), array("template" => "{input}", "style" => "width:20px!important", "separator"=>" "))',

                ),

        'username',

    ),
)); ?>
于 2013-08-19T12:53:52.763 回答