Results 1 to 2 of 2

Thread: Can't re-add a previously removed TreeNode to my TreePanel

  1. #1

    Default Can't re-add a previously removed TreeNode to my TreePanel

    I am trying to add a previously removed treenode (with the layerRoot_Legend.removeAll() method) but when I add it back by using .appendChild(name of node) it does not appear. Is there any way to re-add the node without destroying it as I am guessing it is being completely destroyed since I am able to add different nodes just not ones I have used the remove/removeAll method on. Below is my code appreciate any help on how I can first remove the layerList_Labels node properly then re-add it.

    Code:
    var layerRoot_Legend = new Ext.tree.TreeNode({
    enableDD: true,
    text: "All Legend Items",
    expanded: true
    });
     
    var layerTree_Legend = new Ext.tree.TreePanel({
    title: '',
    root: layerRoot_Legend,
    enableDD: true,
    applyLoader: true,
    rootVisible: false
    });
     
     
    //Labels LayerList 
    layerList_Labels = new GeoExt.tree.LayerContainer({
    text: 'Labels',
    layerStore: mapPanel.layers,
    leaf: false,
    cls: 'rootnode',
    enableDD: true,
    singleClickExpand: true,
    expanded: false,
    checked: false,
    listeners: {
    'checkchange' : function(node, checked)
    {
    // If a parent node is unchecked, uncheck all the children
    if (node.getUI().isChecked()) {
    node.expand();
    node.eachChild(function(child){
    child.ui.toggleCheck(true);
    });
    }
    if (!node.getUI().isChecked())
    {
    node.expand();
    node.eachChild(function(child) {
    child.ui.toggleCheck(false);
    });
    }
    }
    },
    loader: 
    {
    filter: function(record) 
    {
    var myarr = new Array();
    myarr[0] = record.get("layer").name.indexOf("Neighbourhood Label");
    myarr[1] = record.get("layer").name.indexOf("Overview Streets");
    myarr[2] = record.get("layer").name.indexOf("Quadrant Streets");
    myarr[3] = record.get("layer").name.indexOf("Neighbourhood Streets");
    myarr[4] = record.get("layer").name.indexOf("Block Streets");
    myarr[5] = record.get("layer").name.indexOf("Proposed Streets");
    myarr[6] = record.get("layer").name.indexOf("Address Label (Overview)");
    myarr[7] = record.get("layer").name.indexOf("Address Label (Detail)");
    if(myarr[0]==-1 && myarr[1]==-1 && myarr[2]==-1 && myarr[3]==-1 && myarr[4]==-1 && myarr[5]==-1 && myarr[6]==-1 && myarr[7]==-1)
    {
    returnfalse;
    }
    else
    {
    returntrue;
    }
    }
    }
    });
     
    layerRoot_Legend.appendChild(layerList_Labels);
     
    layerRoot_Legend.removeAll();
     
    layerRoot_Legend.appendChild(layerList_AssessedIncrements);
    layerRoot_Legend.appendChild(layerList_Labels);
     
    


    So the previously added layerList_Labels node does not get added because it was already on the treenode, but the AssessedIncrements is added fine, how can I add both? Thanks.


  2. #2

    Default

    nevermind I looked at previous bug reports from the forum and I just added -
    layerRoot_Legend.beginUpdate() and then
    layerRoot_Legend.endUpdate() and it worked.

Similar Threads

  1. How to add removed child panel again
    By enp in forum Ext 3.x: Help & Discussion
    Replies: 19
    Last Post: 16 Mar 2010, 6:06 AM
  2. [FIXED-395][3.1] Removed TreeNode can't be added again
    By Supergibbs in forum Ext 3.x: Bugs
    Replies: 7
    Last Post: 23 Dec 2009, 9:03 AM
  3. Replies: 10
    Last Post: 6 Jun 2009, 7:40 AM
  4. store.add - overwrites record I previously added
    By sneddo in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 11 Aug 2008, 3:21 AM
  5. Replies: 4
    Last Post: 7 Jul 2008, 7:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •