Javascript 将多个函数添加到ExtJS gridPanel按钮';s处理程序
我有一个ExtJS gridPanel,带有一个触发全局函数的按钮:Javascript 将多个函数添加到ExtJS gridPanel按钮';s处理程序,javascript,extjs,Javascript,Extjs,我有一个ExtJS gridPanel,带有一个触发全局函数的按钮: grid = Ext.create('Ext.grid.Panel', { ... tbar: [ { xtype: 'button', text: 'Group', handler: group // call to global function } ] ... }); 调用组函数后,我需要调用另一个全
grid = Ext.create('Ext.grid.Panel', {
...
tbar: [
{
xtype: 'button',
text: 'Group',
handler: group // call to global function
}
]
...
});
调用
组
函数后,我需要调用另一个全局函数,例如重命名组
;如何在处理程序中放置此函数或任何其他函数?我们在JavaScript中所做的通常是定义我们自己的函数调用所有其他函数,因此在您的示例中:
grid = Ext.create('Ext.grid.Panel', {
...
tbar: [
{
xtype: 'button',
text: 'Group',
// will call the function when clicked, which will then call the others
handler: function(e) {
group(e);
renameGroups(e);
}
}
]
...
});
有几种不同的选择
grid = Ext.create('Ext.grid.Panel', {
...
tbar: [
{
xtype: 'button',
text: 'Group',
// will call the function when clicked, which will then call the others
handler: function(e) {
group(e);
renameGroups(e);
}
}
]
...
});
grid.down('[text=Group]')。on('click',function(){})感谢您的回答,以及相关的代码示例,这很容易理解。