Для Админки в GridView используем
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[ 'attribute' => 'prop_id', 'enableSorting' => true, 'filter' => Select2::widget([ 'name' => Html::getInputName($searchModel, 'prop_id'), 'value' => $searchModel->prop_id, 'theme' => Select2::THEME_DEFAULT, 'data' => $dataFilter['properties'], ]), 'value' => function (ShopFilter $model) { return $model->propertyName; }, 'headerOptions' => [ 'width' => 300, ], ], |
Для Формы (ActiveForm)
1 2 3 4 5 6 7 8 9 10 11 |
<?php echo $form->field($model,'type', ['options' => ['class' => 'col-md-2']])->widget(Select2::class, [ 'theme' => Select2::THEME_DEFAULT, 'value' => $model->type, 'hideSearch' => true, 'data' => [ 'news_company' => 'Компания', 'news_assortment' => 'Ассортимент' ] ]); ?> |