Tlopasha Tlopasha - 1 year ago 324
PHP Question

GridView::FILTER_SELECT2 dont work

I try to use SELECT2 as a filter for a column but it didn't render!

This is my code :

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;
echo GridView::widget([
'columns' => [
['attribute' =>'id','filter'=>GridView::FILTER_SELECT2],
'dataProvider'=> $dataProvider,
'filterModel' => $searchModel,


and than I get this result in browser:


Answer Source

It should be filterType instead of filter.

['attribute' => 'id', 'filterType' => GridView::FILTER_SELECT2]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download