My gridview wants to implement rowsapn to two columns, Offical MOU sites and Official MOU sites > 2700. I want some logic to bring value to this two columns.
What is the best way to implement this in Yii2?
I try this code
echo GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'id',
[
'attribute' => 'category',
'value' => function ($model) use ($dataProvider) {
$count = $dataProvider->query->where(['category' => $model->category])->count();
return $model->category . ' (Count: ' . $count . ')';
},
],
'name',
'price',
],
]);
But this is not what I really want.
Thanks!

If you want to implement rowspan for two columns,
Official MOU sitesandOfficial MOU sites > 2700, you can achieve this by customizing the GridView in Yii2. You need to modify the columns array and use the contentOptions property to set the rowspan based on your logic.