Javascript 将Ext.grid.Panel指定给Ext.tab.Panel时出错
我有一个选项卡面板,到目前为止工作正常, 但是,一旦我将网格面板作为选项卡之一应用,我就会在Observerable.js(ext中的一个类)的某个地方收到一个js错误,该错误表示“item.on(…)”不是“item is undefinded”之后的函数 以下是相应的代码行: 这是我在选项卡面板中执行的操作:Javascript 将Ext.grid.Panel指定给Ext.tab.Panel时出错,javascript,extjs,extjs4,Javascript,Extjs,Extjs4,我有一个选项卡面板,到目前为止工作正常, 但是,一旦我将网格面板作为选项卡之一应用,我就会在Observerable.js(ext中的一个类)的某个地方收到一个js错误,该错误表示“item.on(…)”不是“item is undefinded”之后的函数 以下是相应的代码行: 这是我在选项卡面板中执行的操作: initComponent: function() { this.items = [{ xtype: 'profileList',
initComponent: function() {
this.items = [{
xtype: 'profileList',
title: 'Profiles'
}];
this.callParent(arguments);
}
下面是我的网格面板的代码:
Ext.define('BC.view.profile.ProfileList', {
extend: 'Ext.grid.Panel',
alias: 'widget.profileList',
cls: 'profileList',
border: false,
initComponent: function(){
Ext.apply(this, {
store: 'Profiles',
columns: [{
text: 'Name',
dataIndex: 'name',
flex: 1,
}, {
text: 'Others',
dataIndex: 'otherUsers',
width: 200
}, {
text: 'Limit',
dataIndex: 'limit',
width: 200
}]
});
console.log('before');
this.callParent(arguments);
console.log('after');
}
});
谢谢你的帮助
编辑:第一个console.log起作用,错误似乎发生在“callParent()”中。您不能像这样创建选项卡面板的项目:
this.items = [{
xtype: 'profileList',
title: 'Profiles'
}];
您应该使用Ext.apply(…代替:
Ext.apply(this,{items:[{
xtype: 'profileList',
title: 'Profiles'
}]);