我添加了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'
),
),
));
答案 0 :(得分:0)
如果您使用的是bulkActions,则必须使用“列”列出要显示的列,而不是使用“模板”。
'columns' => array(
'id',
'title',
...
),
答案 1 :(得分: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);}'
)
可能是什么原因?