网格 - 按钮单击处理程序

时间:2012-07-02 16:13:15

标签: extjs extjs4 extjs-mvc extjs4.1

在我的Grid中,当我点击操作按钮(下面代码中显示的删除和编辑按钮)时,我需要弹出一个窗口,而不会通过警告消息提醒用户;

在下面的代码中,我使用HANDLER handler: buttonClicked并尝试访问我从下面的其他函数中单击的行值

buttonClicked :function (){...}
  1. 我不知道该怎么做,有人可以帮帮我吗?

  2. 我可以访问我点击的行并在Controller课程中显示其名称吗?


  3. CODE SNIPET

    Ext.define('CountryAppTest.view.user.Gridview', {
        extend: 'Ext.grid.Panel',
        initComponent: function() {
            this.store = 'store';
            this.columns = [{
                xtype: 'ac',
                items: [{
                    icon: 'lib/extjs/examples/restful/images/delete.png',
                    handler: buttonClicked
                }]
            }, {
                text: "username",
                dataIndex: 'username'
            }];
            this.viewConfig = {
                forceFit: true
            };
            this.callParent(arguments);
        },
        buttonClicked: function(grid, rowIndex, colIndex) {
            var rec = grid.getStore().getAt(rowIndex);
            Ext.Msg.alert("Info", "name " + rec.get('username'));
        }
    });
    

1 个答案:

答案 0 :(得分:1)

将参数(grid, rowIndex, colIndex)添加到您的buttonClicked声明中。