【问题标题】:Yii framewok gridview filter dropdownbox with mulitple checkbox带有多个复选框的 Yii 框架 gridview 过滤器下拉框
【发布时间】:2014-09-16 05:40:38
【问题描述】:

我目前正在研究 zii.widgets.grid.CGridView,我想在下拉框中显示带有多个复选框的状态字段以搜索状态

所以下拉框中应该有多选复选框

目前我得到的结果如下图

但想用下拉框中的多个复选框替换

【问题讨论】:

    标签: yii


    【解决方案1】:

    使用多选框作为过滤器。

    一个很好的方法是使用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 中的示例,您还可以在其中了解如何配置模型和控制器。

    【讨论】:

    • 未按预期工作:在我的情况下显示 jquery 缓动错误。见:stackoverflow.com/questions/62064671/…
    • 有什么解决方案可以解决这个问题吗?我添加了扩展,我的布局包含 jquery 和 jquery.ui 加载,如 <?php Yii::app()->clientScript->registerCoreScript('jquery'); Yii::app()->clientScript->registerCoreScript('jquery.ui'); ?>
    猜你喜欢
    • 1970-01-01
    • 2017-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-15
    • 1970-01-01
    相关资源
    最近更新 更多