Kliver Max
Kliver Max

Reputation: 5299

How to get gridPanel cell value? ExtJs

I have a gridPanel with ColumnModel. One of this columns is ActionColumn with buttons. And i want by click a button get a cell value from cell in same row with this button? How to do this?

My ActionColumn

{
        xtype: 'actioncolumn',
        width: 50,
        items: [{
               icon   : url_servlet+'externals/gxp/src/theme/img/pencil.png', 
            tooltip: 'Редактировать участок',
            handler: function(grid, rowIndex, colIndex) {
            alert("DAMACIA!!!!");
           }

Upvotes: 1

Views: 12136

Answers (1)

Jan Korenek
Jan Korenek

Reputation: 214

You have all you need in handler params

handler: function(grid, rowIndex, colIndex) {
            var row = grid.getStore().getAt(rowIndex);
            console.log(row);
           }

The code above will give you the row, so you just need to select desired cell.

If you enforce selection before clicking actioncolumn you can also use code below. But be aware by default clicking on actioncolumn doesn't fire selection, so while clicking actioncolumn an entirely different row can be selected or even no column can be selected at all.

grid.getSelectionModel().getSelection()

Upvotes: 6

Related Questions