2 Replies Latest reply on Nov 20, 2007 2:02 PM by Jank Rod

    Edit node name in flex tree

    Flextron Level 1
      I want to edit a node in flex tree. Editable property of the tree makes all nodes editable based on "SELECT" action . But now based on my custom selection I want to edit a particular node. I thought of custom item renderer and item editor but that applies to all the nodes on "SELECT" action. Please let me know how to edit particular nodes based on particular action.

      Ex: On click of a button i want to edit the name of node (Node is just text with folder icon).

        • 1. Re: Edit node name in flex tree
          theLoggerGuy Level 1
          Yes a custom editor will apply to all nodes, but if you add variable in your data provider (or on the data you already have) you can allow or stop a node edit based on any criteria.
          • 2. Re: Edit node name in flex tree
            Jank Rod

            I was trying to find an answer to the same issue. After walking through the Tree and List class a bit I came up with this. Here is an example where the Tree is not editable and double clicking a node will allow you to rename it.

            tree.addEventListener( ListEvent.ITEM_DOUBLE_CLICK, itemDoubleClick );
            tree.addEventListener( ListEvent.ITEM_EDIT_END, itemEditEnd );

            private function itemDoubleClick( event:ListEvent=null ):void
            tree.editable = true;
            tree.editedItemPosition = {rowIndex:tree.selectedIndex};
            private function itemEditEnd( event:ListEvent=null ):void
            tree.editable = false;

            - Jank