I am changing the background color of cells using setcell option in grid complete. I have successfully changed the background color as I wanted, but the time taken to load data is faster compared to the changing the color. It takes longer time, some time browser get crashed due to the huge data.
I am wondering is there any way to change background color of cell from server side response(JSON format)?
gridComplete: function()
{
var rows = $("#tableid").getDataIDs();
var ref={};
for (var i=0;i<rows.length;i=i+1){
if(i==2){
rowData=jQuery("#tableid").getRowData(rows[2]);
var count= Object.keys(rowData).length;
for(var j=1;j<=count;j++){ ref[j]=rowData['r'+j];}
$("#tableid").jqGrid('setRowData',rows[2],false,color:'white',weightfont:'bold',background:'green' });}
if(i>2){
rowData=jQuery("#tableid").getRowData(rows[i]);
for(var j=1;j<=count;j++){
if(rowData['r'+j]==ref[j]){
$("#tableid").jqGrid('setCell',rows[i],'r'+j,''{color:'white',weightfont:'bold',background:'green'}); }
else if(rowData['r'+j]=='-'){
$("#tableid").jqGrid('setCell',rows[i],'r'+j,'',{color:'black',weightfont:'bold',background:'white'}); }
else if(rowData['r'+j]== 'R'){
$("#tableid").jqGrid('setCell',rows[i],'r'+j,'',{color:'black',weightfont:'bold',background:'yellow'});
}
else if(rowData['r'+j]== 'M'){
$("#tableid").jqGrid('setCell',rows[i],'r'+j,'',{color:'black',weightfont:'bold',background:'yellow'});
}
else if(rowData['r'+j]== 'Y'){
$("#tableid").jqGrid('setCell',rows[i],'r'+j,'',{color:'black',weightfont:'bold',background:'yellow'});
}
else if(rowData['r'+j]== 'S'){
$("#tableid").jqGrid('setCell',rows[i],'r'+j,'',{color:'black',weightfont:'bold',background:'yellow'});
}
else if(rowData['r'+j]== 'K'){
$("#tableid").jqGrid('setCell',rows[i],'r'+j,'',{color:'black',weightfont:'bold',background:'yellow'});}
else {
$("#tableid").jqGrid('setCell',rows[i],'r'+j,'',{color:'black',weightfont:'bold',background:'red'}); }
}
}
} },