I created two trees and when I move a node from one tree to another I would like to know names of old and new tree. I added data-tree-name="unsorted"
in ui-tree
but I don't know how to access it. This is my code:
<div ui-tree="treeOptions" data-tree-name="unsorted">
<ol ui-tree-nodes="" ng-model="skill.unsorted">
<li ng-repeat="sk in skill.unsorted" ui-tree-node>
<div ui-tree-handle>
@{{ sk.name }}
</div>
</li>
</ol>
</div>
<div ui-tree="treeOptions" data-tree-name="sorted">
<ol ui-tree-nodes="" ng-model="category">
<li ng-repeat="cat in category" ui-tree-node>
<div ui-tree-handle>
@{{ cat.name }}
</div>
<ol ui-tree-nodes="" ng-model="cat.skills">
<li ng-repeat="sk in cat.skills" ui-tree-node>
<div ui-tree-handle>
@{{ sk.name }}
</div>
</li>
</ol>
</li>
</ol>
</div>
----------------------------------------------------
$scope.treeOptions = {
accept: function(sourceNodeScope, destNodesScope, destIndex) {
return true;
},
dropped: function(e) {
console.log (e.source.nodeScope);
}
};
So how can I get data-tree-name
value. Thanks
See the documentation for dropped event in official docs:
dropped(event)
If a node moves it's position after dropped, the nodeDropped callback will be called.
Parameters:
Here is an example: