Extjs - Get rowIndex of a selected row

DeLe picture DeLe · Jun 24, 2013 · Viewed 54.4k times · Source

I have been seleted a row, and now i want get rowIndex

maybe like

grid.getSelectionModel().getSelection()[0].rowIndex

but it's undefined. How can i get it thanks

Answer

wens picture wens · Jun 27, 2013

how about this?

var selectedRecord = grid.getSelectionModel().getSelection()[0];
var row = grid.store.indexOf(selectedRecord);

you have to get the selected record of your grid and from that, you can search this record from your store and get its index.