In ExtJS grid, I can get the index of the selected data item as follows:
grid.getSelectionModel().on('rowselect', function(sm, index, rec){
changeMenuItemInfoArea(menuItemApplication, 'you are on row with index ' + index);
var row_number_parts = rec.id.split('-');
var selected_index = row_number_parts[2] - 1;
alert(selected_index);
});
But how do I get the index of the selected data item on double click?
When I do this:
listeners: {
'rowdblclick': function(grid, rowindex, e){
console.log(...);
}
}
both gridand e, it seems, do not have the necessary information, but are rowindexnot useful, because if the user resorts to a column, then the double-row row index is not necessarily equal to the index of the data set that loaded the grid.
Adding
Thanks @McStretch, I eventually solved the problem by putting idin the list of elements, hiding the identifier column, and then sending the identifier to the edit page, for example:
listeners: {
'rowdblclick': function(grid, index, rec){
var id = grid.getSelectionModel().getSelected().json[0];
go_to_page('edit_item', 'id=' + id);
}
}