以前,我的网格运行良好,因此我决定添加一个initComponent方法,以便自己进行初始化。
我所要做的就是如下向类中添加一个initComponent函数,并带有alert()消息。
警报弹出,然后出现此错误消息:
无法读取未定义的属性“ applyColumnsState”
Ext.define('js.grid.PackageGrid', {
referenceToToolbar: this.toolbar,
extend: 'Ext.grid.Panel',
title: '',
xtype: 'array-grid',
collapsible: true,
multiSelect: true,
store: tablestore,
autoExpandColumn: 'name',
columns: createColumns(),
loadMask: true,
stateful: true,
stateId: 'packageGrid',
filterable: true,
viewConfig: {
stripeRows: true,
enableTextSelection: true
},
initComponent : function (){
alert('hi')
},
}
我需要满足什么才能使initComponent方法不会引发此错误?
您必须在initComponent
覆盖中调用父方法才能正确完成组件初始化。
因此,您的initComponent
方法应如下所示:
initComponent : function (){
alert('hi')
this.callParent();
},
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句