当关联的网格被销毁时,Ext 网格插件监听器被删除

Ext grid plugin listeners getting removed when associated grid is destroyed

var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 2,
listeners: {
    'beforeedit': function (rowIdx, colIdx) {

    },

    'validateedit': function (editor, e) {            
}

});

我已经创建了一个像上面一样的单元格编辑插件并将其附加到我的网格。

 var grid = Ext.create('Ext.grid.Panel', {
                            width: width,
                            height: height,
                            frame: true,
            plugins: [cellEditing]

问题是当我使用 Ext.getCmp('GridId').destroy(); 破坏我的网格时插件的侦听器正在获取 removed.What 我可以像以前一样重新配置插件吗?

您可以尝试动态创建和分配插件。

var grid = Ext.create('Ext.grid.Panel', {
    width: width,
    height: height,
    frame: true,
    plugins: [
        Ext.create('Ext.grid.plugin.CellEditing', {
            clicksToEdit: 2,
            listeners: {
                beforeedit: function (rowIdx, colIdx) {
                },
                validateedit: function (editor, e) {            
                }
            }
        });
    ]
});