I am trying to adapt the following example:
http://jsfiddle.net/dvAcu/My goal is to load data when a node is expanded. How would I return data back to loader's success function if I am getting data into a callback?
I wrote something like this for testing:
loader:function(param,success,error){
if (!param.id)
promise = assetsMVCService.execute("assetprojectstatus", { assetId: 1, dataFormat: 'attribute' });
else
promise = assetsMVCService.execute("assetprojectstatus", { assetId: param.id, dataFormat: 'attribute' });
//promise.then(scope.assetChildren);
success(promise.then(scope.assetChildren)); // tried that, not working
},
Initially data is loaded because param.id does not exist. When I click on a node I am getting into scope.assetChildren function but returning data from it is not working.
I dont see it and the node that's been expanded stays closed.
Please share some ideas.
Thanks