Need to add custom formatting to a jqGrid cell or row based on certain conditions? Here’s How…

Just use afterInsertRow, add an anonymous function which passes in the rowID and all your columns.

From there you can do just about anything you want to. The code is below.

afterInsertRow: function(rowid, aData) {
			
			//if last posting is less more than an hour ago highlight
			if (aData.myCol > 60) {
			    //add a css style to the entire row	   
                            $("#"+rowid).addClass("ui-state-error");
			 }
			else
			 {
			     //make just the cell text green
                             jQuery('#gridId').setCell(rowid, 'myCol', '', { color: 'green' }); 
			 } 
		}

Happy Coding.