Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs 使用relayEvent_Extjs_Extjs4 - Fatal编程技术网

Extjs 使用relayEvent

Extjs 使用relayEvent,extjs,extjs4,Extjs,Extjs4,我有一个简单的DelButton类: DelButton = Ext.extend(Ext.Button, { ,disabled: false ,listeners: { ,selectionchange: function() { alert('!!!!'); } ,initComponent:function() { this.relayEvents(this.grid.getSelection

我有一个简单的DelButton类:

DelButton = Ext.extend(Ext.Button, { ,disabled: false ,listeners: { ,selectionchange: function() { alert('!!!!'); } ,initComponent:function() { this.relayEvents(this.grid.getSelectionModel(), ['selectionchange']); DelButton.superclass.initComponent.call(this); } }); DelButton=Ext.extend(Ext.Button{ ,已禁用:false ,听众:{ ,selectionchange:function(){ 警惕(“!!!!”); } ,initComponent:function(){ this.relayEvents(this.grid.getSelectionModel(),['selectionchange']); DelButton.superclass.initComponent.call(this); } }); buildTBar:函数(配置){ config.tbar={} config.tbar.push(newdelbutton({grid:this})) } , buildConfig:function(config){ this.buildTBar(配置) } ,

AbstractEditorRidPanel=Ext.extend(Ext.grid.EditorRidPanel{ initComponent:function(){ 变量配置={ 默认值:{border:true,autoHeight:false} }; 这个.buildConfig(config); Ext.apply(this,Ext.apply(this.initialConfig,config)); AbstractEditorGridPanel.superclass.initComponent.call(this); }
为什么relayEvent在这种情况下不起作用?(this.grid.getSelectionModel存在)

您有一些小问题。请尝试以下操作:

AbstractEditorGridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
    initComponent:function() {
        var config = {
            defaults:{border:true, autoHeight:false }
        };
        this.buildConfig(config);
        Ext.apply(this, Ext.apply(this.initialConfig, config));
        this.callParent(arguments);
    },
    buildTBar: function(config) {
        config.tbar = [];
        config.tbar.push(new DelButton({grid:this, text: 'Text'}))
    },
    buildConfig:function(config) {
        this.buildTBar(config)
    }
});

为什么要从按钮中触发“selectionchange”? buildConfig:function(config) { this.buildTBar(config) } AbstractEditorGridPanel = Ext.extend(Ext.grid.EditorGridPanel, { initComponent:function() { var config = { defaults:{border:true, autoHeight:false } }; this.buildConfig(config); Ext.apply(this, Ext.apply(this.initialConfig, config)); AbstractEditorGridPanel.superclass.initComponent.call(this); }
AbstractEditorGridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
    initComponent:function() {
        var config = {
            defaults:{border:true, autoHeight:false }
        };
        this.buildConfig(config);
        Ext.apply(this, Ext.apply(this.initialConfig, config));
        this.callParent(arguments);
    },
    buildTBar: function(config) {
        config.tbar = [];
        config.tbar.push(new DelButton({grid:this, text: 'Text'}))
    },
    buildConfig:function(config) {
        this.buildTBar(config)
    }
});