Using CRUD generated GridView . In my case, there are a lot of columns in the table in the database, so that the page does not drag over the width, I have prescribed adaptive styles for the tables.
<div class="table-responsive"> <?= GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'tableOptions' => ['class' => 'table table-striped table-responsive'], 'columns' => [ ['class' => 'yii\grid\SerialColumn'], 'col_1', 'col_2', 'col_3', ... 'col_30', 'col_31', ['class' => 'yii\grid\ActionColumn'], ], ]); ?> </div> In the end, a little awkward turns out to work scrolling left to right.
Therefore, I wanted to ask if there is a possibility to select the required fields, and form a table using a group of checkboxes, for example
GridViewtable, show a list of all fields (columns) and next to it there is a checkbox for everyone to choose from. The user could select the fields (columns) he needs and click the button let's sayсформировать таблицу. AndGridviewgenerate a table with columns that the user has selected. I hope I could explain - Xfirab