Here’s a real time saver, adding this code at the top of the page will add a function named getSelectedRowIndex , and as the name suggests it returns the selected index, or -1 if there is no selection on the grid.
getSelectedRowIndex = function(grid){
var r = grid.getSelectionModel().getSelection();
var s = grid.getStore();
return s.indexOf(r[0]);
}
Use it like this
var rowIndex = getSelectedRowIndex(grid);
Pingback: Extending extjs’s selection model to get the rowIndex on a rowClick | Learn Some Things
Just was I looking for!