Angular ui-tree detect drag event between connected trees

1k Views Asked by At

I would like to detect event when item was dragged from tree#1 and dropped to tree#2. In this case i would like to call a specific http action to save it. I use the dropped event with actions inside one tree, but i can't manage it when i move item between trees. I tried to find differences in event 'dest' and 'source' objects, but did not found any solution.

1

There are 1 best solutions below

0
On BEST ANSWER

I solved my problem. I added custom data-tree-type attribute to the tree

 <div ui-tree="treeOptions" id="tree-root" data-tree-type="mainTree" data-drag-delay="200">
        <ol ui-tree-nodes ng-model="data">
            <li ng-repeat="node in data" data-info="{{node.pageId}}" ui-tree-node ng-include="'nodes_renderer.html'"></li>
        </ol>
</div>

and then in angular-ui-tree.js in directive uiTree i added watch function

scope.$watch(attrs.treeType, function (val) {
     scope.treeType = attrs.treeType;
});

Now i can compare treeType attributes in droped event dest and source objects.