1. #1
    Ext User
    Join Date
    Oct 2007
    Posts
    29
    Vote Rating
    0
    bsklar_ca is on a distinguished road

      0  

    Smile Help removing a node from a tree

    Help removing a node from a tree


    I have the following code to remove a node for a tree:

    Code:
    var options = {
    	url:this.deleteUrl || this.url
    	,method:this.method
    	,scope:this
    	,callback:this.cmdCallback
    	,node:node
    	,params:{
    	cmd:'delete'
    	,file:this.getPath(node)
                }
    };
    options.node.parentNode.removeChild(options.node);
    If the node is a leaf with at least two leafs on the branch it works fine. However, when the
    node is a leaf and that is the only leaf then the leaf is removed but the parent node, which was a folder, is changed to a leaf. I would like for either the parent node to be removed as well or for the parent node to stay as afolder. Thanks for any help.
    Bruce Sklar
    Senior User Experience Engineer

  2. #2
    Ext User zhegwood's Avatar
    Join Date
    Dec 2007
    Location
    Boulder, CO Suburbia (Lafayette)
    Posts
    388
    Vote Rating
    1
    zhegwood is on a distinguished road

      0  

    Default


    Why not use options.node.remove() to remove the node?

    As far as making it a folder, you could try setting the leaf property to false after you do the remove. ie. parentNode.leaf = false.

  3. #3
    Ext User
    Join Date
    Oct 2007
    Posts
    29
    Vote Rating
    0
    bsklar_ca is on a distinguished road

      0  

    Default


    I tried the following change:

    Code:
    var par = options.node.parentNode;
    options.node.parentNode.removeChild(options.node);
    par.leaf = false;
    I still get the same result.

    I also tried:

    Code:
    options.node.remove();    // this works
    parentNode.leaf = false;   // this has no effect
    The node which was a folder is now a leaf and that is not what I want.
    Bruce Sklar
    Senior User Experience Engineer

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..." hd porno faketaxi