ezraroi / ngJsTree

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

Adding new node to tree not reflecting #52

Closed mdraees closed 8 years ago

mdraees commented 8 years ago

Added a new node to tree like vm.getSelectedCategories = function(e,node) { treeViewService.getTreeChildData(node.node.id).then(function(data){ angular.forEach(data.data, function(value, key) { $timeout(function() { vm.addNewNode(value.id,value.parent,value.text); }); }); }); }; vm.addNewNode = function(id,parentId,text) { vm.treeData.push({ id : id, parent : parentId, text : text}); }; but here, data is adding to the treeData Array. but not reflecting the same in the tree.

Note : if i added vm.treeConfig.version++; i can see the node in the tree. but this will re create the entire tree.

please let me know how i can avoid this re-creation of tree

thanks in advance :)

ezraroi commented 8 years ago

Look on the demo code, it is working fine. Please reproduce the issue in plunker

mdraees commented 8 years ago

ok..

How problematically i can open a node ??

vm.getSelectedCategories = function(e,nodeObj) {

//nodeObj is my selected node

}); thanks in advance :)

ezraroi commented 8 years ago

Please check the jsTree documentation and see in the demo how to invoke a method in the jsTree API