问题
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.
回答1:
Do it like this...
for(var i=0; i<grid.getDataLength(); i++){
if(grid.getData()[i].firstColumnID == 'firstColumnValue'){
rowIndex = i;
}
}
回答2:
getRowById(id)
- Returns the index of a row with a given id
回答3:
I know I'm late but may be with better solution?
grid.getData().getIdxById('UniqueFieldValue')
来源:https://stackoverflow.com/questions/18189722/extract-row-index-from-slickgrid-using-a-unique-cell-value