Надо вывести виджет фильтра FILTER_SELECT2 (field multi_diet_param_id) в panelbeforeheader или вне таблицы/выше таблицы.
Код: Выделить всё
$columnsConfig = [
[
'class' => SerialColumn::class
],
'id',
'name',
[
'attribute' => 'multi_diet_param_id',
'vAlign' => 'middle',
'width' => '180px',
'value' => function ($model, $key, $index, $widget) {
return '';
},
'filterType' => GridView::FILTER_SELECT2,
'filter' => $offerList,
'filterWidgetOptions' => [
'pluginOptions' => ['allowClear' => true],
'options' => ['multiple' => true]
],
'filterInputOptions' => ['placeholder' => 'Diet type'],
'format' => 'raw'
],
[
'attribute' => 'idRestaurantType',
'filter' => RestaurantType::selectList($type),
'value' => function ($model) {
$values = [];
foreach ($model->restaurantTypes as $type) {
$values[] = $type->name;
}
return implode(', ', $values);
}
],
];
GridView::widget([
'id' => 'restaurant',
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'instructionRef' => 'manage-restaurant',
'noteKey' => $noteKey,
'panelBeforeTemplate' => $panelBeforeTemplate,
'formatter' => [
'class' => Formatter::class,
'nullDisplay' => '',
],
'filterSelector' =>
,
'actionButtons' => [
[
'text' => RestaurantBModule::t('app', 'Create a restaurant'),
'url' => [
'create'
],
'visible' => Yii::$app->user->can(RestaurantBModule::ROLE_RESTAURANT_IMPROVER)
]
],
'columns' => $columnsConfig,
])
Идеи?