我尝试使用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]
]);
?>
而不是我在浏览器中得到这个结果:
答案 0 :(得分:0)
应该是filterType
而不是filter
。
['attribute' => 'id', 'filterType' => GridView::FILTER_SELECT2]