【发布时间】:2014-08-26 12:24:23
【问题描述】:
在这段代码中,有很多现有的函数,但我必须开始使用这些函数制作一些扩展的 ExtJS 类。
如何将现有函数添加到类的侦听器中?
例如:
Ext.define("My.Grid", {
extend: 'Ext.grid.Panel',
//...
initComponent: function() {
//...
Ext.apply(this, {
//...
tbar: [{
xtype: 'button',
icon: 'img/x.png',
handler: function(){
// need to call randomOtherFunction here
}
}]
});
}
});
function randomOtherFunction () {
// ...
}
【问题讨论】:
-
不太确定您遇到问题的原因。只需调用另一个函数。
-
它说:“randomOtherFunction 不是一个函数” - 但现在我有了一个想法,尝试一下,如果它有效,我会回来告诉它...... :)