我有简单的 DelButton 类:
DelButton = Ext.extend(Ext.Button, { ,禁用:假 ,听众:{ ,选择更改:函数(){ 警报('!!!!'); } ,initComponent:function() { this.relayEvents(this.grid.getSelectionModel(), ['selectionchange']); DelButton.superclass.initComponent.call(this); } });
buildTBar:功能(配置){ config.tbar = {} config.tbar.push(new DelButton({grid:this })) },
构建配置:功能(配置){ this.buildTBar(config) },
AbstractEditorGridPanel = Ext.extend(Ext.grid.EditorGridPanel, { 初始化组件:函数(){ 变量配置 = { 默认值:{border:true, autoHeight:false } }; this.buildConfig(config); Ext.apply(this, Ext.apply(this.initialConfig, config)); AbstractEditorGridPanel.superclass.initComponent.call(this); }
为什么在这种情况下 relayEvent 不起作用?( this.grid.getSelectionModel 存在)