GridView :: FILTER_SELECT2不起作用

时间:2016-11-23 14:29:28

标签: php gridview yii

我尝试使用SELECT2作为列的过滤器,但它没有渲染!

这是我的代码:

<?php
use yii\helpers\Html;
use yii\widgets\LinkPager;
use yii\widgets\ListView;
use yii\data\ActiveDataProvider;
use kartik\grid\GridView;
use yii\widgets\Pjax;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use app\models\country;
?>
 <?php
echo GridView::widget([
'columns' => [  
        ['attribute' =>'id','filter'=>GridView::FILTER_SELECT2],
       'name'],
    'dataProvider'=> $dataProvider,
     'filterModel' => $searchModel,
        'export'=>false,
        'pjax'=>true,
        'pjaxSettings'=>[
        'neverTimeout'=>true]

]);
   ?> 

而不是我在浏览器中得到这个结果:

photo

1 个答案:

答案 0 :(得分:0)

应该是filterType而不是filter

['attribute' => 'id', 'filterType' => GridView::FILTER_SELECT2]