Для адаптивных колонок в yii2 GridView нужно добавить следующий код в виджет
1 2 3 4 5 6 |
'tableOptions' => [ 'class' => 'table table-striped', ], 'options' => [ 'class' => 'table-responsive', ], |
Полный пример
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'tableOptions' => [ 'class' => 'table table-striped', ], 'options' => [ 'class' => 'table-responsive', ], 'columns' => [ ['class' => 'yii\grid\SerialColumn'], 'id', 'name', 'path', [ 'attribute' => 'popular', 'filter' => Select2::widget([ 'name' => 'ShopBrandSearch[popular]', 'value' => $searchModel->popular, 'hideSearch' => true, 'theme' => Select2::THEME_DEFAULT, 'data' => [ null => 'Все', '1' => 'Да', '0' => 'Нет', ], ]), 'value' => function ($model) { return $model->popular == true ? 'Да' : 'Нет'; }, 'headerOptions' => [ 'width' => 130, ], ], [ 'class' => 'yii\grid\ActionColumn', 'template' => '{view} {update}' ], ], ]); |