[英]Extjs 4.1: So strange error: Uncaught TypeError: Cannot read property 'items' of undefined
you can change sample: app/simple/app/Viewport.js
to this: 你可以改变样本:
app/simple/app/Viewport.js
到这个:
you'll get this error in Chrome console: 您将在Chrome控制台中收到此错误消息:
Uncaught TypeError: Cannot read property 'items' of undefined ext-all.js:18 Ext.cmd.derive.getDockedItems
未捕获的TypeError:无法读取未定义的ext-all.js的属性'items':18 Ext.cmd.derive.getDockedItems
But if you comment this: 但如果你评论这个:
initComponent : function() {
this.callParent();
},
Everything is ok. 一切都好。
Ext.define('AM.view.Viewport', {
extend : 'Ext.container.Viewport',
layout: 'border',
items : [{
border : false,
region : 'north',
xtype : 'progressbar',
text : 'Ready',
height : 20
}, {
region : 'west',
xtype : 'userlist',
width:300
}, {
region : 'center',
xtype : 'treepanel',
initComponent : function() {
this.callParent();
},
columns : [{
xtype : 'treecolumn',
sortable : false,
width : 200,
text : 'lala',
dataIndex : 'text'
}, {
flex : 1,
sortable : false,
text : 'haha',
dataIndex : 'pars'
}]
}]
});
1- try to call with the Parents arguments like this: 1-尝试使用这样的Parents参数调用:
.
.
.
,initComponent : function() {
this.callParent(arguments);
},
.
.
.
OR call the the super Class: 或者调用超类:
.
.
,initComponent : function() {
this.callSuper(arguments);
},
.
.
.
initComponent works only for the newly defined component. initComponent仅适用于新定义的组件。 In your case for 'AM.view.Viewport'.
在您的情况下'AM.view.Viewport'。 You can not override initComponent for component inserted as config of component in items.
您不能覆盖作为项目中组件的配置插入的组件的initComponent。 If you want to define initComponent for that treepanel, you have to extend it as well and then put this extension into items of your viewport.
如果要为该treepanel定义initComponent,则必须对其进行扩展,然后将此扩展名放入视口的项目中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.