最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to get gridPanel cell value? ExtJs - Stack Overflow

programmeradmin0浏览0评论

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()
发布评论

评论列表(0)

  1. 暂无评论