Question

I have a grid panel with an actioncolumn.

There is an icon in the actioncolumn, and its click handler works fine.

But when I click the icon, in the click handler I want to access the selected row, but it seems no row is selected.

Is this expected? Do I need to manually set the selected row when an actioncolumn icon is clicked?

No correct solution

OTHER TIPS

If you want to select row also after user click on icon in actioncolumn just set actioncolumn stopSelection config property to false:

{    
    xtype:'actioncolumn',
    stopSelection: false,
    items: [{
       ...
    }]
}

However common use case how to access row's record when user click on icon in action column is get index of the row where user click on the action column icon and get record from store at this index:

{
    xtype:'actioncolumn',
    items: [{
        tooltip: 'Edit',
        handler: function(grid, rowIndex, colIndex) {
            // get record at index of row where user click on icon in action column
            var record = grid.getStore().getAt(rowIndex);
            // do action with record ...
        }
    }]
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top