2
votes
    rowname="r1";
    changes[1]["num1"] = "changed";
    grid.invalidateRow(1);
    grid.setCellCssStyles("highlight", changes);

    grid.render();

Is there a way to get the index of a row in slickgrid if I have a cell value of first column which is unique? In the above code I want to use as changes[rowindex]["num1"]="changed" where "num1" is my column name and "r1" is first column cell value.changes["r1"]["num1"]="changed" does not works.

3
I want to know the row index if I have a value="r1" in my grid. - zooney

3 Answers

0
votes

Do it like this...

for(var i=0; i<grid.getDataLength(); i++){
   if(grid.getData()[i].firstColumnID == 'firstColumnValue'){
       rowIndex = i;
   }
}
0
votes

getRowById(id) - Returns the index of a row with a given id

0
votes

I know I'm late but may be with better solution?

grid.getData().getIdxById('UniqueFieldValue')