1

I am currently using Angular UI Tree connected trees. Tree1 has only one level of depth while Tree2 is unlimited in depth. I need to be able to drag any item from Tree2 INTO Tree1 items and catch that event.

Just to clarify: In effect Tree1 is the top level items of Tree2 and this allows me to easily move items between the overall data structure.

I could not find a way to do this under the current documentation, so I did the following: On Tree1 I disabled drop:

<div ui-tree="tree1Options" id="tree1-root" data-nodrop-enabled='true'>

and then on Tree2 I added the following call backs:

<div ui-tree="tree2Options" id="tree2-root">

$scope.tree2Options = {
dropped : function(event) {
      console.log("dropped" + event);
    },

    dragStop : function(event) {
      console.log("dragStop" + event);
    },

    beforeDrop : function(event) {
      console.log("beforeDrop" + event);
    },
}

When I drag from Tree2 onto Tree1 no placeholder is shown (which is fine), but I cannot get which item the drop was on from the destination. Seems like the dest is actually the source.

Any ideas? Also, if you know a better way to achieve DROP INTO?

1
  • Having the same issue, did anyone find a 'drop-into' solution from Tree 1 to Tree 2? Commented Oct 18, 2016 at 13:49

1 Answer 1

0

Seems like one set of callbacks per scope, perhaps its possible to add a flag to the data coming in so it knows which different model its coming from to run a diffeent function under a case switch within the one callback

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.