Answer the question
In order to leave comments, you need to log in
How to make a different cell background in a non-standard order in gridview?
In the grid, you need to make a different background for the cells, but not as usual, as well as 1.2 background1 and 3.4 background2, and so on
, you need to shaman here
'rowOptions'=>function ($model, $key, $index, $grid){
$class=$index % 2 ? 'odd' : 'even';
return [
'key'=>$key,
'index'=>$index,
'class'=>$class
];
},
Answer the question
In order to leave comments, you need to log in
And what for yii to pull? This is a task for css and :nth-of-type
tr:nth-of-type(1), tr:nth-of-type(2) {background-color:red;}
tr:nth-of-type(3), tr:nth-of-type(4) {background-color:green;}
<tbody class="ui-sortable">
<tr data-key="7" class="ui-sortable-handle"><td style="border-top:1px solid; ">1</td><td ><img src="/upload/images/team/586246181f77b.png" alt="" style="width:35px;height:35px;"> Zenit St. Petersburg - [ robot_dqaTH ] </td></tr>
<tr data-key="1" class="ui-sortable-handle"><td >2</td><td><img src="/upload/images/team/5894d64081ada.png" alt="" style="width:35px;height:35px;"> Amkar Perm - [ akula22 ] </td></tr>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question