Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
Add Styling to row/cell on igGrid based on Data


I have a grid with data. I also have a button called 'Validate'. I'm trying to implement a logic such that when I click on the validate button, it goes through all the row data and highlights the row based on the data it contains (For Eg: Highlight the row if the data on a column is missing). I have a function like this, but the row doesn't seem to get highlighted. Please help.

$("#validate").on('igbuttonclick', function (e)
var rows = grid.igGrid("allRows");
var dataField1,dataField2;
$.each(rows, function (index, row) {
rowId = $(row).attr("data-id")
dataField1 = grid.igGrid("getCellValue", rowId, "DataField1");
if (dataField1 == "Val1")
dataField2=grid.igGrid("getCellValue", rowId, "DataField2");
if ( dataField2== "")
$("#invGrid").igGrid("cellById", rowId, "DataField2").addClass("errorHighlight");

Here, I've tried a cell highlight which is jot working. A row highlight will also help me.