1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    35
    Vote Rating
    0
    marklar is on a distinguished road

      0  

    Default TreePanel control says registered with Ext.dd.ScrollManager

    TreePanel control says registered with Ext.dd.ScrollManager


    When I load a tree control inside of a layout and then remove it, there are "parts hanging around" causing errors.

    Here is the setup and the error.

    I load a ContentPanel object into a LayoutRegion via Ajax. The object has the following code that builds tree on init. I unload the object and remove the related ContentPanel it was loaded in, etc. but when I resize the parent layout, it gives a message that says "Unspecified Error"

    Code:
    	    var Tree = Ext.tree;
                var tree = new Tree.TreePanel('somelabel'), {
                    animate:true, 
                    enableDD:true,
                    containerScroll: true,
                    dropConfig: {appendOnly:true}
                });
                new Tree.TreeSorter(tree, {folderSort:true});
                me.root = new Tree.TreeNode({id:'home', text:'YUI-Demo', cls: 'folder'});
                tree.setRootNode(me.root);
                tree.render();
                tree.on('click', this.nodeClicked );
    When you debug of course you are 100 layers deep in the middle of an event call, but I chopped the problem in 1/2 until I determined that the problem is as follows:

    The following code in the Ext.tree.TreePanel - render function registers its el with the Scrollmanager using the Ext.dd.ScrollManager.register(this.el); call.
    Code:
        render : function(){
    
            this.container = this.el.createChild({tag:"ul",
                   cls:"x-tree-root-ct " +
                   (this.lines ? "x-tree-lines" : "x-tree-no-lines")});
            
            if(this.containerScroll){
                Ext.dd.ScrollManager.register(this.el);    //root cause - no unregister related to this
            }
    Why this turns into an error:
    ---------------------------------
    Then the Ext.dd.ScrollManager onFire event kicks off....

    in the process is calls ...
    dds.refreshCache();

    This function ends up calling the following line which causes the error due to no related region (it was removed along with the ContentPanel and object - just this stray div hanging around).

    els[id]._region = els[id].getRegion();


    In my own master objects unload function if the closing object has a tree then I "manually" unregister it - which fixed the error.
    Ext.dd.ScrollManager.unregister(this.o.tree.getEl())

    It seems odd that something would register itself but not unregister itself.

    Am I doing something wrong here to not have the tree unregister on its own? Is there a call I can make that will unregister and remove items like this as needed that I do not know of (i.e. destroy() )?

    Thanks,

    Joseph

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    There is no destroy method for a tree. Unfortunately, that means it doesn't do automatic clean up so you will need to do clean up yourself.

    In a future release I am sure we will add automatic clean up.
    Jack Slocum
    Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum
    jack@extjs.com

  3. #3
    Ext User
    Join Date
    Mar 2007
    Posts
    35
    Vote Rating
    0
    marklar is on a distinguished road

      0  

    Default Please provide details when docs come out

    Please provide details when docs come out


    Many hours are spent chasing down what was needed here. When the documentation comes out, can you include cleanup items that are internal? It seems like making one function and documenting that would be easier though. The only way I knew this was happening was to read the code and find out the TreePanel is registering itself and not cleaning up. And finding that out was tough - the error was in an event fired after the object is closed - from the scroll manger. Think about how hard that is to find.

    This is why I added this to the bug forum - a crash in the middle of region resize that happen on internal code due to internal code is a bug to most people. Anyone that puts a tree in a layout and them removes everything will hit this and be glad to know what cleanup item they need to be chasing.

    Thanks for the reply.

    Great tool, it should sell like hotcakes.

  4. #4
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    When creating a component as complex as a tree with DND, there are many things that take place that need to be cleaned up (not just the ScrollManager issue).

    component != element

    Simply overwriting a component's HTML or removing it's DOM node and expecting everything to just magically disappear IMO is a bad assumption. In most instances, there's really no way for the component to even know it no longer exists in the DOM.

    You are 100% correct though, who wants to go hunt all that stuff down?! In most instances, Ext does provide automatic clean up functionality for you. I'm sure the Tree will have this as well soon.
    Jack Slocum
    Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum
    jack@extjs.com

  5. #5
    Ext User
    Join Date
    Mar 2007
    Posts
    35
    Vote Rating
    0
    marklar is on a distinguished road

      0  

    Default I was not expecting anything ...

    I was not expecting anything ...


    Jack, I wrote a special process to track all loaded objects and content panels and a master cleanup object. I am not just killing the dom and then complaining that it broke.

    Please consider adding a thread on "things you need to cleanup" for items like this until such time that every component has a destroy method that does needed cleanup items.

    Again, thanks for the active replies.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."