CellEditor shared between grids

January 05th, 2009 edit

  • Hello,

    I am using a comboxBox cellEditor that is shared between multiple grids. The cellEditor is created by a helper class. Everything works fine until I close the window the grid is in, the next time I open it and click on the cell, it just stays blue and the editor does not appear. Inspecting the DOM shows that the gridEditor elm does not get destroyed and its store still exists etc.

    My guess is that it is being destroyed or changed when the window/panel is closed. If I force the re-creation of the gridEditor each time the grid is loaded it works, but I want my grid editors to persist.

    Any ideas?


  • Well, I have a solution to this that works in my scenario:

    Basically in my system class (that holds the common cellEditors) I have a function like this:


    getAlignCellEditor: function(){

    // destory the editor if it exists
    if (!this.cellEditor.alignCellEditor){

    // create the editor
    this.cellEditor.alignCellEditor = new Ext.grid.GridEditor(new Ext.form.ComboBox({...});
    }
    return this.cellEditor.alignCellEditor
    }


    This creates and returns the cellEditor if it does not exist. So my grid uses getAlignCellEditor() when setting the customEditor.

    On my grids, I added a listener for the beforeDestroy() event and call:


    destroyPropPanelEditors: function(){

    if (this.cellEditor.alignCellEditor){
    this.cellEditor.alignCellEditor.field.destroy();
    delete this.cellEditor.alignCellEditor;
    }

    }


    So, I destory the cellEditors when the grid is closed so that when the grid is re-created, the call to getAlignCellEditor() creates a new instance of the cellEditor and returns it.

    This works, its not exactly what I wanted. I wanted the cellEditor to persist. I tried using autoDestroy:false on the grid, but for whatever reason I could never re-use the cellEditors...







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about CellEditor shared between grids , Please add it free.