admin管理员组

文章数量:1382502

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

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!!!!");
           }
Share Improve this question asked Jul 13, 2012 at 8:45 Kliver MaxKliver Max 5,30924 gold badges101 silver badges157 bronze badges 1
  • I'm not sure but i think that this answer will help. Agnese – softwareplay Commented Sep 13, 2013 at 9:47
Add a ment  | 

1 Answer 1

Reset to default 6

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()

本文标签: javascriptHow to get gridPanel cell value ExtJsStack Overflow