Open Rabi-Narayan opened 8 years ago
Hi, please write a plunker that reproduces your problem and I will try to look on it
Thanks for the reply ezraroi. Now i am doing ajax call inside the Jstree configuration itself.Now this issue is resolved.But can u please suggest me to get into solution for possibility of populating jstree by using REST services inside tree config ?If so is there any reference for guidance ?? Thanks in advance.
@Rabi-Narayan, the right behavior in this case is to inject the necessary dependencies into your directive or controller before-hand either using resolve functions (for route navigation or, say, UIBS modals) or directly using promises.
jsfile.txt
Hi ezraroi, modified in the way u suggested to make empty array and pushed the response data but it failed to create child nodes and gives error while trying to open a parent node. treeCtrl: error from js tree - {"error":"nodata","plugin":"core","id":"core_05","reason":"Could not load node","data":"{\"id\":\"ajson1\"}"}
my config and data to load initial tree is like this.Given some initial data to populate tree because it is not creating any node in other ways. vm.treeData = [ { id : 'ajson1', parent : '#', text : 'Simple root node', state: { opened: false},children:true }, { id : 'ajson2', parent : '#', text : 'Root node 2', state: { opened: false},children:true }, ];
I am getting data from http service like this:
var promise = ravensService.getChildren();
I am calling the follwing function on "open_node" event of jsTree.But before this event i am getting above error :( vm.openChildNode = function() { vm.treeData.push(data.data); };
I have tried all the stuffs and working on same from days but unable to find solution.I am using jsTree in Angularjs.Since i am new to this please help in this regard.Thanks in advance.PFA for Js.