Код: Выделить всё
| id | total | group |
+---+------+-------+
| 1 | 1 | 1 |
| 2 | 2 | 2 |
| 3 | 0 | 1 |
| 4 | 5 | 2 |
Код: Выделить всё
группа1
данные с полем group=1
данные с полем group=1
группа2
данные с полем group=2
данные с полем group=2
стандартный
Код: Выделить всё
$query = Table::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
Код: Выделить всё
[
'attribute'=>'group',
'width'=>'310px',
'value'=>function ($model, $key, $index, $widget) {
return $model->group;
},
'group'=>true, // enable grouping,
'groupedRow'=>true, // move grouped column to a single grouped row
'groupOddCssClass'=>'kv-grouped-row', // configure odd group cell css class
'groupEvenCssClass'=>'kv-grouped-row', // configure even group cell css class
],
в таком виде
группа1
данные с полем group=1
группа2
данные с полем group=2
группа1
данные с полем group=1
группа2
данные с полем group=2