I have a jqgrid and I would set a background color for a row.
....,
gridComplete: function(){
var ids = jQuery("#tabImprese").jqGrid('getDataIDs');
for(var i=0;i &开发者_JAVA百科lt; ids.length;i++){
var cl = ids[i];
...........
}
},....
How can I do? Thanks.
I understand your question so, that you want to change the background color of some rows based on the content of the column of the row.
You can do this in many ways. You need enumerate all rows inside of loadComplete
or gridComplete
event handler add the class to the row element (<tr>
) or set background
CSS style. The most important thing is just how you enumerate all rows and examine the content of the row. The answer shows the most effective method (this.rows[iRow]cells[iCol]
) to enumerate the rows and examine the column contain. Another answer discuss advantages and disadvantages of different ways how the background color could be changed.
you can use $yourRow.effect("highlight", {color:"whateverColoryourwant"},3000);
You can access the row using the following selector:
jQuery("#" + cl, "#tabImprese").
I have used this to apply an effect to a row, for example a temporary highlight:
jQuery("#" + rowId).effect("highlight", {}, 2000);
But you also should be able to add a class to the row to apply your own custom highlighting.
精彩评论