hi,
in kartik gridview i have to use dropdown in filtering city data.
in index file
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'cityName',
'value' => 'cityName',
'filterType'=>GridView::FILTER_SELECT2 ,
'filterWidgetOptions' => [
'data' => ArrayHelper::map(City::find()->all(), 'cityName', 'cityName'),
'options' => ['placeholder' => 'Wilaya'],
'pluginOptions' => ['allowClear' => true],
],
],
],
'containerOptions' => ['style'=>'overflow: true; '], // only set when $responsive = false
'pjax' => true,
'pjaxSettings' =>[
'neverTimeout'=>true,
'options'=>[
'id'=>'kv-unique-id-1',
]
],
'bordered' => true,
'striped' => false,
'summary' => false,
'condensed' => false,
'responsive' => true,
'tableOptions'=>['style'=>'font-size: 14px; '],
'hover' => true,
'floatHeader' => true,
'toolbar' => [
'{export}',
'{toggleData}',
],
'showPageSummary' => false,
'panel' => [
'heading' =>'State',
'type' => GridView::TYPE_PRIMARY
],
]); ?>
filter is not working page is refresh but there is no parameter pass in url
in url:http://localhost/yii2demo/city/index?CitySearch[cityId]=&CitySearch[cityName]=