0 Replies Latest reply on Dec 26, 2007 3:00 AM by lucky_raga

    not able to move branch when its child is dragged and dropped

    lucky_raga Level 1
      Hi,

      I have two trees, one is source, to drag and the other destination, to be dropped.
      My requirement is when an item (leaf node) is dragged and dropped, i want to represent that item
      in the dropped location in the same hierarchical way i.e., by creating a replica of that parent in the
      dropped location. When i follow the below code, it do not work.

      //onDragDrop

      var dropTarget:Tree = Tree(event.currentTarget);
      var insertNewParentNode:XML = <b></b>;
      var childNode:XML = <c></c>;
      childNode.@label = insertItemNode.@label;
      insertNewParentNode.@label = insertParentNode.@label;
      insertNewParentNode.setChildren(childNode);

      dropTarget.dataProvider.addChildAt(insertNewParentNode, 1);
      // the above code only moves leaf nodes or the dragged items.
      //i also tried using below,
      dropTarget.dataDescriptor.addChildAt(dropTarget, insertNewParentNode, dropIndex);

      I am stuck at this point, not able to understand why flex is restricting movement of branch or replicating branch
      at the dropped location.

      Please advice.

      Thanks,
      Lucky