ezraroi / ngJsTree

Angular Directive for the famous JS Tree
http://ezraroi.github.io/ngJsTree/
MIT License
270 stars 101 forks source link

Order of data while using DND flug-in #109

Closed gauravbhavsar closed 7 years ago

gauravbhavsar commented 7 years ago

Hi,

I am trying to display treeData as it is showing in treeView hierarchy. But the problem is order of node.

when I drag any node to different place, an actual treeData sequence does not change based on dragable node.

suppose I have 4 nodes in tree like below

when I drag 1st node after 3rd node, Tree looks like

but treeData remain in same order as

$scope.treeData =  { id : '1', parent : '#', text : '1st node'},
                   { id : '2', parent : '#', text : '2nd node'},
                   { id : '3', parent : '#', text : '3rd node'},
                   { id : '4', parent : '#', text : '4th node'}

so when I used ng-repeat to display treeData its remain in same order as

<ul>
    <li ng-repeat="data in treeData">{{data.text}}<li>
</ul>

its give me

for this I tried start-dnd stop-dnd event to change the array index by using splice function of javascript, but I am fail to find the actual index of array and dragable index of array.

Let me know if there is any solution to achieve this.

gauravbhavsar commented 7 years ago

Issue solved.

Updated plunker