代码之家  ›  专栏  ›  技术社区  ›  Pallav

当关联的网格被破坏时,Ext网格插件侦听器被删除

  •  0
  • Pallav  · 技术社区  · 9 年前
    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();插件的侦听器正在删除。我可以做什么来重新配置插件?

    1 回复  |  直到 9 年前
        1
  •  1
  •   Joe Horn    9 年前

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

    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) {            
                    }
                }
            });
        ]
    });