0

我从yii-booster添加了复选框功能。但是该小部件在没有所需框的情况下呈现模型视图。怎么了?

视图中的 Widjet 代码

<?php
$this->widget('bootstrap.widgets.TbExtendedGridView',array(
'id'=>'docs-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'type'=>'bordered condensed',
'template' => "{items}",
'bulkActions' => array(
    'actionButtons' => array(
        array(
                'buttonType' => 'button',
                'type' => 'primary',
                'size' => 'small',
                'label' => 'Choose',
                'click' => 'js:function(values){console.log(values);}'
                )
            ),
            // if grid doesn't have a checkbox column type, it will attach
            // one and this configuration will be part of it
        'checkBoxColumnConfig' => array(
        'name' => 'id'
        ), 
  ),    
));
4

2 回答 2

0

问题出在示例中的错误层次结构中:“checkBoxColumnConfig”属性必须“actionButtons”属性之外:

'bulkActions' => array(
    'actionButtons' => array(
        /*array(
                'buttonType' => 'button',
                'type' => 'primary',
                'size' => 'small',
                'label' => 'Выбрать отмеченные',
                'click' => 'js:function(values){console.log(values);}'
                )
            ),*/
            // if grid doesn't have a checkbox column type, it will attach
            // one and this configuration will be part of it

    ), 
    'checkBoxColumnConfig' => array(
        'name' => 'id'
        ), 
...
));

但是现在当我取消注释'actionButtons'中的数组部分时,小部件不起作用:

 array(
                'buttonType' => 'button',
                'type' => 'primary',
                'size' => 'small',
                'label' => 'Выбрать отмеченные',
                'click' => 'js:function(values){console.log(values);}'
                )

可能是什么原因?

于 2013-08-21T06:37:38.037 回答
0

如果您使用 bulkActions,则必须使用“列”列出要显示的列,而不是使用“模板”。

'columns' => array(
    'id',
    'title', 
    ...
),
于 2013-08-21T02:25:55.517 回答