javascript - Angular UI Tree - Allow only drag & drop into second level (children nodes) -
i using angular ui tree.
my object:
[ { "id": 1, "title": "class1", "students": [ { "id": 11, "title": "student1.1", }, { "id": 12, "title": "student1.2" } ] }, { "id": 2, "title": "class2", "students": [] }, { "id": 3, "title": "class3", "students": [ { "id": 31, "title": "student3.1" } ] } ]
what want achieve allow students drag & drop inside classes (the classes not have draggable, , students not have dropped first level (classes) second level (students)).
is possible achieve angular ui tree?
i made this:
i check in destination scope parent still uitreenode.
in controller:
$scope.treeoptions = { accept: function(sourcenodescope, destnodesscope, destindex) { if (destnodesscope.$parent.$type === "uitreenode"){ return true; }else{ return false; } } };
and in view:
<div ui-tree="treeoptions">
Comments
Post a Comment