网格 - 按钮点击处理器

问题描述:

在我的Grid,当我点击动作按钮(下面的代码中显示的删除和编辑按钮),我需要弹出打开一个窗口,而不提醒用户警告消息;网格 - 按钮点击处理器

在下面的代码中,我使用HANDLER handler: buttonClicked并尝试访问我从下面的不同函数中点击的行值; buttonClicked :function(){...

1.)我不知道该怎么做,有人可以帮我吗?

2.)我可以访问我单击的行并显示其Controller类的名称吗?

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')); 
    } 
    }); 
+0

对你的问题的答案是肯定的。你有没有看过[MCV文档](http://docs.sencha.com/ext-js/4-1/#!/guide/application_architecture)?你应该能够弄清楚如何从那里做到这一点。 – Izhaki

+0

我试过MVC文档,但我仍然无法得到这个工作。 –

+0

你在第8行有错误的支架 –

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

+0

当我这样做,它说'处理程序:buttonClicked没有定义。 –

+0

在声明中你有buttonClicked:function(){} – sha

+0

我已编辑我的代码,请看看 –