2017-04-05 104 views
0

我的設置列使用kartik DynaGrid Widget在yii2上顯示數據。但過濾器(FILTER_SELECT2)不在我的桌子上呈現。有人能幫我嗎?請。kartik DynaGrid select2 filter not render

'class' => 'kartik\grid\DataColumn', 
    'attribute' => 'city_id', 
    'label' => 'City', 
    'hAlign' => 'center', 
    'vAlign' => 'middle', 
    'width' => '70px', 
    'filterType' => GridView::FILTER_SELECT2, 
    'filter' => [ 
     1 => 'filter 1', 
     2 => 'filter 2', 
    ], 
    'format' => 'html', 
    'value' => function($data){ 
     $cities = \app\models\City::getData(); 
     if(isset($cities[$data->city_id])){ 
      return $cities[$data->city_id]; 
     } 

     return $data->city_id; 

    } 

回答

0

發佈您的網格配置。也許你在配置中關閉過濾器。默認配置是這樣的

.... 
    'gridOptions'=>[ 
      'dataProvider'=>$dataProvider, 
      'filterModel'=>$searchModel, 
      .... 
    ],