我有一个 MVC 架构,但是当我尝试在现有的一个 TabPanel 中创建另一个 TabPanel 时,我在浏览器中得到了这个:
el is null
el = el.dom || Ext.getDom(el); ext-all-debug.js (line 12807)
据我了解,似乎新的 TabPanel 无法找到需要的 div 来呈现。无论如何,这是控制器:
Ext.define('FI.controller.MainController', {
extend: 'Ext.app.Controller',
id: 'mainController',
views: ['MainTabPanel', 'UnitsTabPanel', 'SummariesTabPanel'],
mainTabPanel : {},
unitsTabPanel : {},
summariesTabPanel : {},
init: function(){
console.log("main controller is init");
console.log(this);
this.control({
'mainTabPanel':{
afterrender: this.onCreate
}
});
this.mainTabPanel = Ext.widget('mainTabPanel');
},
onCreate: function(){
console.log("main tab panel is created");
console.log(this);
this.unitsTabPanel = Ext.widget('unitsTabPanel');
this.summariesTabPanel = Ext.widget('summariesTabPanel');
}
});
这是MainTabPanel:
Ext.define("FI.view.MainTabPanel", {
extend: 'Ext.tab.Panel',
renderTo:'container',
alias: 'widget.mainTabPanel',
enableTabScroll: true,
items:[{
title:'Units',
html: "<div id='units'></div>",
closable: false
},
{title: 'Summaries',
html: "<div id='summaries'></div>",
closable:false
}
]
});
这是SummariesTabPanel(有问题的那个):
Ext.define("FI.view.SummariesTabPanel", {
extend: 'Ext.tab.Panel',
renderTo: 'summaries',
alias: 'widget.summariesTabPanel',
enableTabScroll: true
});
问题出在SummariesTabPanel
. 如果我不创建它,则会UnitsTabPanel
渲染。由于某种原因,它找不到summaries
div。
你能告诉我有什么问题吗?