I've seen other posts on this subject but my is slightlty different I have a jqGrid as shown below with the following name:
grid = $("#list");
Now, I have a column named total and I want to set a color for the numbers based on a value. I tried like this
grid.jqGrid({
...
colModel:[
...
{name:'total',index:'total',width:60,
formatter:function(cellvalue, options, rowObject){
if (cellvalue > 300) {
return "<span style='background-color:orange'>"+cellvalue+"</span>";
} else {
return "<span style='color:red'>"+cellvalue+"</span>";
}
},
align:'right'},
...
which seems to evaluate fine the if conditional but fail to display the cellvalue variable.
How should I redisplay the total cell value with the proper markup inside the if brackets?