Answer the question
In order to leave comments, you need to log in
GridView how to change the background-color of a row by some condition?
Good day and productive workflow to you comrades.
The question is simple, but my eyes have already blurred something on Friday. I use GridView like this
echo grid\GridView::widget([
'dataProvider' => $dataProvider,
'columns' => $gridColumns,
'containerOptions' => ['style' => 'overflow: hidden;'],
'headerRowOptions' => ['class' => 'kartik-sheet-style'],
'hover' => true,
'floatHeader' => true,
'id' => 'gridView',
'pjax' => true,
'pjaxSettings'=>[
// 'options' => $this->registerJs("a()"),
],
'summaryOptions' => ['id'=>'summary', 'name'=>'unchanged'],
'persistResize' => false,
'resizableColumns' => false,
'export' => false
]);
Answer the question
In order to leave comments, you need to log in
To do this, you can change the HTML attributes of the row through the rowOptions property, like this:
echo grid\GridView::widget([
'rowOptions' => function ($model, $key, $index, $grid) {
return ['class' => 'red-color'];
}
)]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question