Open Karttin opened 10 years ago
I'm interested in this too since I don't have all the tree data at first.
me2
+1
I am currently working on this. I figured out a way of doing it.
Essentially, on selected node click, scope.functionname.
Have the function in the controller, use your factory to load data and then inject data into the selected node. Make sure to pass the node to the function.
When i am fully done with the treeview project i am working on i will post a solution for lots of scenarios.
Hi I know it's too late to answer this question but recently I applied one solution to achieve what you are asking for?
In your "selectedNode" method you can call one method written in the controller like -
scope.selectNodeHead = scope.selectNodeHead || function(selectedNode) { if (!selectedNode.collapsed){ scope.populateSample(selectedNode); }else{ selectedNode.collapsed = !selectedNode.collapsed; } };
and Inside your controller -
$scope.populateSample= function(selectedNode){
var Id= selectedNode.idKey;
var req = {
method: 'GET',
url: "case/" + Id+ "/sample",
headers: {
"Content-Type" : "application/json; charset=UTF-8" }
};
$http(req).success(function(jsondata){
......
}
Hope this helps.. :-)
Thanks for the example @amarpreethora https://guides.github.com/features/mastering-markdown/#examples
Hi I know it's too late to answer this question but recently I applied one solution to achieve what you are asking for?
In your "selectedNode" method you can call one method written in the controller like -
scope.selectNodeHead = scope.selectNodeHead || function(selectedNode) { if (!selectedNode.collapsed){ scope.populateSample(selectedNode); }else{ selectedNode.collapsed = !selectedNode.collapsed; } };
and Inside your controller -
$scope.populateSample= function(selectedNode){ var Id= selectedNode.idKey; var req = { method: 'GET', url: "case/" + Id+ "/sample", headers: { "Content-Type" : "application/json; charset=UTF-8" } }; $http(req).success(function(jsondata){ ...... }
Hope this helps.. :-)
I need to call a function in controller when a node is selected. Based on the selected node value, i need to call server api for results. Is there any way to accomplish this? Also I need to show in which level current selected node in breadcrumb.
Please anyone help me.
Hi,
Your tree view is simple and clean. Is there any way i can add nodes based on a AJAX/Get call for each node?
Kind Regards Kay