Lorenz Meyer
Lorenz Meyer

Reputation: 19945

Get the focussed row (not the selected)

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 ?

Upvotes: 0

Views: 235

Answers (1)

Guilherme Lopes
Guilherme Lopes

Reputation: 4760

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);
                }
            });
        }
    }
});

Upvotes: 3

Related Questions