In Yii2 GridView, if you want to highlight or focus on certain row,
you can use rowOptions attribute in your gridview.
Below are the example code.
<?=
GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'rowOptions' => function ($model, $index, $widget, $grid) {
if ($model->is_read == 1) {
return ['class' => 'read'];
} else {
return [];
}
},
'columns' => [
['class' => 'yii\grid\SerialColumn'],
['class' => 'yii\grid\ActionColumn']
],
]);
?>
Below are the example code.
<?=
GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'rowOptions' => function ($model, $index, $widget, $grid) {
if ($model->is_read == 1) {
return ['class' => 'read'];
} else {
return [];
}
},
'columns' => [
['class' => 'yii\grid\SerialColumn'],
['class' => 'yii\grid\ActionColumn']
],
]);
?>