我尝试按照http://www.sencha.com/forum/showthread.php?234909-tab-panel-doesn-t-switch-between-tabs-的建议将 this.callParent(arguments) 添加到选项卡面板的初始化事件中动态添加时,但我得到:
Uncaught Error: this.callParent() was called but there's no such method (doFire) found in the parent class (Ext.Base).
有人能指出我正确的方向吗?
谢谢你。
我的控制器如下:
Ext.define('MyApp.controller.MyController', {
extend: 'Ext.app.Controller',
config: {
refs: {
mytabpanel: '#mytabpanel'
}
},
init: function(application) {
this.control({
mytabpanel: {
initialize: function(component, options){
var bar = component.getTabBar();
bar.insert(0, { flex:1, xtype:'toolbar', title: '' });
bar.insert(bar.getItems().length,
{
xtype: 'toolbar',
flex: 1,
title: '',
items: [
{
xtype : 'button',
docked: 'right',
ui: 'round',
iconCls: 'info',
iconMask: true,
handler: function(){
}
}
]
});
this.callParent(arguments);
}
}
});
}
});
我的看法如下:
Ext.define('MyApp.view.MyTabPanel', {
extend: 'Ext.tab.Panel',
config: {
id: 'mytabpanel',
items: [
{
xtype: 'container',
title: 'Tab 1',
iconCls: 'info',
html: 'tab 1'
},
{
xtype: 'container',
title: 'Tab 2',
iconCls: 'info',
html: 'tab 2'
},
{
xtype: 'container',
title: 'Tab 3',
iconCls: 'info',
html: 'tab 3'
}
],
tabBar: {
docked: 'bottom'
}
}
});
编辑 12 月 30 日星期日上午 6:57(格林威治标准时间 - 4:00)
通过搜索网络,我现在相信因为我重写了初始化,所以我需要调用超类的初始化方法,以便它的代码也将被执行。正如 user1479606 所指出的那样,调用 this.callParent 将永远不会起作用。所以,问题就变成了:如何调用超类的初始化方法?