extjs 7.x classic ux包
使用treepicker绑定store时报错:
TypeError: Cannot read properties of null (reading ‘$eventOptions’) at constructor.addManagedListener (Observable.js?_dc=1641516240871:577) at constructor.aliasOneMember. [as mon] (Base.js?_dc=1641516240871:1175) at constructor.initComponent (TreePicker.js?_dc=1641516240875:67) at constructor (Component.js?_dc=1641516240871:2268)
绑定在beforerender中初始化 treepicker时在initComponent中给store添加事件监听,此时绑定尚未初始化,store值为null,导致异常
覆盖默认实现,改为在updateStore时添加事件监听
Ext.define('PSR.overrides.Ext.ux.TreePicker', {
override: 'Ext.ux.TreePicker',
initComponent: function() {
var me = this;
this.store = this.store || Ext.data.StoreManager.lookup('ext-empty-store');
me.callParent(arguments);
},
updateStore:function(store){
this.mon(store, {
scope: this,
load: this.onLoad,
update: this.onUpdate
});
},
});
node_modules/@sencha/ext-ux/classic/src/TreePicker.js
initComponent: function() {
var me = this;
me.callParent(arguments);
me.mon(me.store, {
scope: me,
load: me.onLoad,
update: me.onUpdate
});
},