ExtJS多个听众 [英] ExtJS multiple listeners
本文介绍了ExtJS多个听众的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试过:
afterrender:function(){...},
pre>
function(){...}
但它不会触发这两个功能。
解决方案只需在函数回调函数中进行多个函数调用。下面显示了一个完整的例子...
Ext.create('Ext.grid.property.Grid',{
标题:'属性网格',
width:300,
renderTo:Ext.getBody(),
functionOne:function(){
alert(functionOne called );
},
functionTwo:function(){
alert(functionTwo called);
},
listeners :$ {
}
$ }
});
I have a property grid that I want to add multiple "afterrender" listeners to. Is it possible to add multiple listeners of the same type, or fire multiple functions within one listener?
I've tried:
afterrender: function(){...}, function(){...}
but it does not fire both of the functions.
解决方案Just make multiple function calls within the function callback. Below shows a full example of this...
Ext.create('Ext.grid.property.Grid', { title: 'Properties Grid', width: 300, renderTo: Ext.getBody(), functionOne: function() { alert("functionOne called"); }, functionTwo: function() { alert("functionTwo called"); }, listeners: { afterrender: function() { var me = this; me.functionOne(); me.functionTwo(); } } });
这篇关于ExtJS多个听众的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文