a. color a row depending on the value of a cell:
//get total rows in you grid
var numberOfRecords = myObjectofGrid.getGridParam("records");
for(var i=1;i<=numberOfRecords;i++)
{
var rowdata =myObjectofGrid.getRowData(i);
var seVal = rowdata.mycolumn;
switch(seVal){
case 'red': myObjectofGrid.jqGrid('setRowData',i,false,'myRedColor-Class');break;
case 'green' : myObjectofGrid.jqGrid('setRowData',i,false,'mygreenColor-class');break;
}
}
b. insert image in a cell depending on the value of a cell:
myObjectofGrid.setColProp('mycolumn',{formatter:myFormatter}).trigger('reloadGrid');
myFormatter:
function myFormatter (cellvalue, options, rowObject)
{
switch(cellvalue){
case 'img1': newCell="<img src='../../Content/images/ui-flag_someimg1.png' />"+cellvalue;break;
case 'img2' : newCell="<img src='../../Content/images/ui-flag_someimg2.png' />"+cellvalue;break;
}
return newCell;
}