2 Replies Latest reply on May 18, 2007 10:09 AM by kokochka

    Tree component index confusion

    incomt65
      Hello,

      I have a Tree component and need to access some nodes by its index. This is to make a "move up/down" control. My idea, after trying many, is to duplicate the selected (current) node up or down, then replace the content of the original with the previous node content.

      I wish not to use previousSibling or nextSibling since, as it seems, it doesn't recognizes either the origin and destination nodes are in the same hierarchical level.

      Working with some index function doesn't works as I would expect when in 2nd level nodes (that is, some child nodes of the first nodes) ; for example:

      -- node (index 1)
      -- node (index 2)
      -- child (index 3)
      -- child (index 4)
      -- node (index 5)

      if the selected node is the second child of the second node, index = 4, and then I substract this number to get the (supposedly) previous child,, that is, in index 3, then I get the node in index 5.... my thought is that, when closed, the node in index 5 was actually index 3.

      Any clarification on how this could be happening is greatly appreciated. Thanks,
      Alvaro Medina
        • 1. Re: Tree component index confusion
          kokochka
          I also need to get a exact position in the nodes for a selected item, such as in the following format
          getTreeNodeAt(0).getTreeNodeAt(5)

          in order to delete certain folders
          thisTree.getTreeNodeAt(0).getTreeNodeAt(5).removeTreeAt(2)

          How can I do this?? All i can get so far is node object by thisTree.selectedNode ...
          • 2. Re: Tree component index confusion
            kokochka Level 1
            I have found myselft an answer.

            To remove un item from a Tree component, you need to specify the node level where the selected node should be deleted.
            //////////////////////////
            treeComponent.selectedNode.removeTreeNode(treeComponent.selectedNode);
            //////////////////////////
            Hope this will help someone else.