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 t开发者_如何学编程d {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
This works for me:
afterInsertRow:function(rowid, rowdata, rowelem){
var status = rowdata['status'];
if(status=='0'){
$("tr.jqgrow#"+rowid).addClass("ui-state-error");
}
}
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
精彩评论