在extjs中通过ID找到选项卡后,为什么不能调用该选项卡上的add()?
在extjs中找到by ID后,为什么不能在选项卡上调用“add”在extjs中通过ID找到选项卡后,为什么不能调用该选项卡上的add()?,extjs,Extjs,在extjs中找到by ID后,为什么不能在选项卡上调用“add” var tabPanel = new Ext.TabPanel({ id:'maintabs', activeTab:0, layoutOnTabChange:true, deferredRender:false }); var tab = { title:'testing', html:'testing' } I can see in my chrome console
var tabPanel = new Ext.TabPanel({
id:'maintabs',
activeTab:0,
layoutOnTabChange:true,
deferredRender:false
});
var tab = {
title:'testing',
html:'testing'
}
I can see in my chrome console that tabPanel here has the method "add", and I can add this tab to the tab panel...
但是,当我在视口中定义选项卡时,就像这样
initComponent: function(){
Ext.apply(this, {
layout: {
type: 'fit'
},
items: [
{
xtype: 'tabpanel',
id:'maintabs',
layoutOnTabChange:true,
deferredRender:false,
activeTab: 0, // index or id
items:[...
然而,考虑到以下几点:
Ext.get('maintabs').add(tab);
TypeError: Object [object Object] has no method 'add'
这里有什么?为什么没有“添加”方法 在
get
和getCmp
之间存在差异get()
返回DOM元素的包装器getCmp()
返回一个外部组件(或子类)