LayoutManager destroy function?

  • I am constantly removing / creating NestedLayoutPanel's which contain Grids, other NestedLayoutPanels, etc. Should I be worried about leaks since there is no destroy method that gets called on the Layouts, Regions and each Panel when I remove a parent NestedLayoutPanel (at least none I could find)?


  • Hi matjaz,
    looking for exact this feature I read this thread and tried out your code! Unluckely I cannot get it to work. Perhaps there is s.th. wrong with my call:

    innerLayout.destroy();Following the usual samples innerLayout is the nested BorderLayout .

    I call your code from .js -file after loading ext stuff. (1.1)

    Firebug error :
    this.el has no properties

    Thanks for any help in advance.

    Mark


  • I was questioning the same thing.
    I have nested layout with many content panels across regions.
    I implemented my own destroy() methods something like: destroy: function()
    {
    delete this.panel;
    abc.FilterPanel.superclass.destroy.call(this);
    }

    I used kalebwalton's (whose code is incorrect) idea of implementing this:Ext.override(Ext.LayoutManager, {
    destroy: function()
    {
    for (var region in this.regions) {
    var r = this.regions[region];
    for (var i=0, len=r.panels.length; i r.panels.itemAt(i).destroy();
    }
    }
    }
    });

    Ext.override(Ext.NestedLayoutPanel, {
    destroy: function()
    {
    this.layout.destroy();
    Ext.NestedLayoutPanel.superclass.destroy.call(this );
    }
    });And now contentpanel's destroy() gets called.
    Shouldn't Ext support this ?


  • FYI - I'm just going to do something like the following for the time being:

    /**
    * Destroys each Panel in all the BorderLayouts LayoutRegions
    */
    Ext.BorderLayout.prototype.destroy = function() {
    for(var region in this.regions) {
    for (var i=0,len=region.panels ? region.panels.length : 0;i region.panels[i].destroy();
    }
    }
    };

    /**
    * Destroys the BorderLayout in the NestedLayoutPanel
    */
    Ext.NestedLayoutPanel.prototype.destroy = function() {
    this.layout.destroy();
    Ext.NestedLayoutPanel.superclass.destroy.call(this )
    };







  • #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 LayoutManager destroy function? , Please add it free.