我有类似如下的代码:
Ext.define('GG.view.Workbench', {
extend: 'Ext.container.Viewport',
layout: 'fit',
items: [
{
xtype: 'container',
layout: 'border',
items: [
{
region: 'center',
items: [
Ext.create('GG.view.Foo')
]
},
{
region: 'south',
items: [
Ext.create('GG.view.Bar')
]
}
]
}
],
initComponent: function() {
this.callParent(arguments);
}
});发生的情况是,当两个Ext.create调用放在那里时,代码不能工作。
这是我在Chrome上得到的:
Uncaught TypeError: object is not a function
(anonymous function)
Ext.ClassManager.instantiateext-debug.js:6428
(anonymous function)ext-debug.js:2414
(anonymous function)我应该如何使用这个Ext.create?
发布于 2011-09-30 01:57:45
您正在进行覆盖,并且必须在每次创建类时都会执行的方法中执行该操作
Ext.define('GG.view.Workbench', {
extend: 'Ext.container.Viewport',
layout: 'border',
initComponent: function() {
var me = this;
Ext.apply(me, {
items : me.buildItems()
});
me.callParent(arguments);
},
buildItems: function() {
return [
{
region: 'center',
items: [
Ext.create('GG.view.Foo')
]
},
{
region: 'south',
items: [
Ext.create('GG.view.Bar')
]
}
];
}
});https://stackoverflow.com/questions/7601123
复制相似问题