0

I have a grid, with a selection model that does allow the selection of a row only under certain conditions.

When I click on a row, it gets focussed (it becomes darker gray). I want to add a button, that acts on the currently focussed row.

Since the selection is deactivated, I cannot use the normal way

grid.getSelectionModel().getSelection()

because there is no selection. How can I access the focussed row ?

Lorenz Meyer
  • 19,166
  • 22
  • 75
  • 121

1 Answers1

3

Add this listener to your grid to get information about the focused row.

Ext.create('Ext.grid.Panel', {
    ...
    listeners: {
        afterrender: function(component){
            component.getSelectionModel().on({
                focuschange: function (view, oldFocused, newFocused, eOpts) {
                    console.log(newFocused);
                }
            });
        }
    }
});
Guilherme Lopes
  • 4,688
  • 1
  • 19
  • 42