extjsgridextjs4extjs4.1

Extjs - Get rowIndex of a selected row


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


Solution

  • 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.