Special row styling in JQGrid

StuartProgramming Blog

I had a customer who needed to highlight a row in their JQGrid when certain parameters are met. It turns out for the static table data they were using this is very simple. Just add a new handler to the JQGrid constructor that specified afterInsertRow behavior.

afterInsertRow: function(rowID, rowData, rowElement) {
	if (rowData.onbasehandlerelated!=""){
		$("#"+ rowData,jQuery('#receiptdatatable')).removeClass('ui-widget-content');
		$("#"+ rowData,jQuery('#receiptdatatable')).addClass('ui-state-error');
	}
},

Here I'm updating the row by removing the widget content class and adding the state error class. This will highlight the row as soon as it is inserted.

Tags: 

StuartSpecial row styling in JQGrid