Yii2-如何从Gridview过滤器中删除空白

时间:2018-08-15 11:21:06

标签: yii2

我有这个gridview

GridviewFilter

我想用全部替换状态上的空白,以便其具有全部,有效,无效

视图:网格视图

            [
            'class' => '\pheme\grid\ToggleColumn',
            'contentOptions' => ['class' => 'text-center'],
            'attribute'=>'is_status',
            'enableAjax' => false,
            'filter'=>['1'=>'InActive', '0'=>'Active'],
        ],

我该如何实现?

1 个答案:

答案 0 :(得分:2)

使用filterInputOptions

[
   'class' => '\pheme\grid\ToggleColumn',
   'contentOptions' => ['class' => 'text-center'],
   'attribute' => 'is_status',
   'enableAjax' => false,
   'filter' => ['1' => 'InActive', '0' => 'Active'],
   'filterInputOptions' => ['class' => 'form-control', 'id' => null, 'prompt' => 'All'],
],