I am developing a tree view to show list of categories using AngularJS. I used this git repository.
HTML
<div ui-tree="treeOptions" id="tree-root" data-drag-enabled="true">
<ol ui-tree-nodes ng-model="nodes">
<li ng-repeat="node in nodes"
ui-tree-node
data-type="top-level"
ng-include="'nodes_renderer.html'"></li>
</ol>
</div>
I am able to implement drag and drop elements in the tree. I want to limit the drag and drop capability to only sibling-level elements.
I tried below but still no luck.
JS
$scope.treeOptions = {
accept: function (sourceNodeScope, destNodesScope, destIndex) {
if (sourceNodeScope.$parent.$id === destNodesScope.$parent.$id)
return true;
else
return false;
}
}
I cannot find much about this requirement on GitHub repository. Any help or useful link is highly appreciated.