2014-09-11 70 views

回答

1

使用多选盒作为过滤器与多个复选框来代替。

一个好办法做到这一点,是echmultiselect,它使用jQuery UI MultiSelect Widget

这是如何使用它作为你的CGridView过滤器:从echmultiselect extension page,在这里你还可以找到您如何配置你的模型和控制器

$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 
     ), 
    ), 
)); 

例。