function hightlightGridRows(grid, colName, valueToCheck) { var grid_ids = grid.jqGrid('getDataIDs'); var rowcount = grid_ids.length; var columnNames = grid.jqGrid('getGridParam', 'colNames'); $.each(columnNames, function (i, v) { columnNames[i] = v.toUpperCase(); }); var colNameInUpper = colName.toUpperCase(); if ($.inArray(colNameInUpper, columnNames) > -1) { for (var counter = 0; counter < rowcount; counter++) { var rowid = grid_ids[counter]; var aRow = grid.jqGrid('getRowData', rowid); var celldata = grid.getCell(rowid, colName); if (celldata == valueToCheck) { var trElement = $("#" + rowid, grid); trElement.removeClass('ui-widget-content'); trElement.addClass("gridHighlightRow"); } } } else { alert("Invalid column name to evaluate the condition for highlighting rows in the grid"); } }where
ui-widget-content = It is css class that is applied by default to a JqGrid row.
gridHighlightRow = It is the custom css class to highlight grid row.
No comments:
Post a Comment