How to change background of 1 row in Yii2 Gridview
Got it!
Yii2 : Adding Classes to Rows in the GridView (YouTube)
Yii2 Gridview row by row css expression
Simply add rowOptions to your gridview.
<?= GridView::widget([
'id' => 'scan-batch-grid',
'dataProvider' => $dataProvider,
'rowOptions'=>function($model){
if($a == $b){
return ['class' => 'danger'];
}
},
Thanks for posting your answer Paramone. Worked great.
Here is my implementation:
<?= GridView::widget([
'dataProvider' => $dataProvider,
'rowOptions' => function ($model) {
if ($model->name == 'test') {
return ['class' => 'info'];
}
},