tags:

views:

296

answers:

1

My use case is the following:

Having a table like:

+------------------------------+
| NOTICE  | This is notice #1  |
| WARNING | This is warning #1 |
| NOTICE  | This is notice #2  |
| ERROR   | This is error  #1  |
+------------------------------+

I'd like to have a specific background color for the whole rows depending of the value of first column.

To implement this, I'd like to make use of a class applied on the row so that I can skin it easily with:

tr.NOTICE td {background-color: Yellow}
tr.WARNING td {background-color: Orange}
tr.ERROR td {background-color: OrangeRed}

Not sure it is possible with jqGrid, maybe with a Custom Formatter? No idea how

Thanks in advance

+1  A: 

Found a way to do it:

$("#myGrid").jqGrid({
    ...
    gridComplete: function() {
    var _rows = $(".jqgrow");
    for (var i = 0; i < _rows.length; i++) {
      _rows[i].attributes["class"].value += " " + _rows[i].childNodes[0].textContent;
    }
});0
Patrick Allaert