【发布时间】:2014-09-16 05:40:38
【问题描述】:
我目前正在研究 zii.widgets.grid.CGridView,我想在下拉框中显示带有多个复选框的状态字段以搜索状态
所以下拉框中应该有多选复选框
目前我得到的结果如下图
但想用下拉框中的多个复选框替换
【问题讨论】:
标签: yii
我目前正在研究 zii.widgets.grid.CGridView,我想在下拉框中显示带有多个复选框的状态字段以搜索状态
所以下拉框中应该有多选复选框
目前我得到的结果如下图
但想用下拉框中的多个复选框替换
【问题讨论】:
标签: yii
使用多选框作为过滤器。
一个很好的方法是使用echmultiselect,它使用jQuery UI MultiSelect Widget。
这是在你的 CGridView 中使用它作为过滤器的方法:
$this->widget('zii.widgets.grid.CGridView', array(
....
'columns' => array (
'firstColumn',
'secondColumn',
// use EchMultiSelect for the next column
array (
'name'=>'thirdColumn',
'filter'=> $this->widget('ext.EchMultiSelect.EchMultiSelect', array(
'model' => $model,
'dropDownAttribute' => 'thirdColumn',
'data' => $colors,
'options' => array('buttonWidth' => 80, 'ajaxRefresh' => true),
),
true // capture output; needed so the widget displays inside the grid
),
),
));
echmultiselect extension page 中的示例,您还可以在其中了解如何配置模型和控制器。
【讨论】:
<?php Yii::app()->clientScript->registerCoreScript('jquery'); Yii::app()->clientScript->registerCoreScript('jquery.ui'); ?>