1 Reply Latest reply on Jul 10, 2006 11:57 AM by Flex harUI

    adding childnodes to a tree

    KUZELJ
      hi,

      can please anybody tell me how to add a child node to a parent node
      i a tree control AND have that new childnode visible immediatly?

      i am able to add that new childnode and have it visible BUT i need
      to close the parent node and open it again (manually) before i see
      the new node.

      i have tried different ways now for hours. i am simply not able
      to get it done.

      some methods i tried

      treeControl.selectedItem = new MyTreeNode(aListOfChildNodes);
      treeControl.invalidateDisplayList();
      treeControl.invalidateList();
      treeControl.validateNow();
      treeControl.expandItem(x, false);
      var x = treeControl.indexToItemRenderer(treeControl.selectedIndex);
      x.visible = false;
      x.stage.invalidate();
      x.visible = true;
      x.invalidateDisplayList();
      x.updateCompletePendingFlag = true;
      x.validateDisplayList();

      please please anybody tell me how to get that
      running. it drives me nuts!

      thx

      robertj
        • 1. Re: adding childnodes to a tree
          Flex harUI Adobe Employee
          Assuming you have the parent node, you should use the TreeDataDescriptor to get the list of children, and add the child via that collection of children. That way the tree gets notified and will do the most efficient thing to get the new child to display.

          The giant hammer is to call invalidateList() (not invalidateDisplayList())