I'm using jQGrid with grouping. Each group header will have one of three possibilites: Pending
, Duplicate
, Not Duplicate
.
Based on that text, I want to change the background color of my grouping header. I'm already using the rowattr
property of jQGrid to change the background color of my grid rows, but I can't figure out how to change the grouping header color.
Here is my implementation of rowattr
, which I believe should be similar to the grouping header background color:
gridview: true,
rowattr: function (rd) {
alert(rd.duplicateStatusName);
if (rd.duplicateStatusName === "Pending Review") {
return { "class": "css_trStatusBackground_pending" };
}
else if (rd.duplicateStatusName === "Duplicate") {
return { "class": "css_trStatusBackground_dup" };
}
else if (rd.duplicateStatusName === "Not a duplicate") {
return { "class": "css_trStatusBackground_notdup" };
}
},
Here is a screenshot of my current grid:
I want that dark gray header color to be a different color (similar to my row color) based on that text in the header.
Is this possible?
Current implementation of
groupingRender
don't allow to use some kind ofrowattr
to style the grouping headers. So You have to iterate over the groupsgroupingView.groups
, test thevalue
and add the css class manually inside ofloadComplete
.The demo demonstrates possible implementation of the approach:
The corresponding code could be the following: