Bind Angular TreeView to RemoteData
Attachment: TreeviewAngular_c2ebcd9c.zip
Thanks for using Sycnfusion products,
We have analyzed your requirement and we have prepared the sample based on your requirement.
Please get the sample from below location
Sample
In this sample, we have get the data from controller using $http.get method in angular factory.
| [script] userApp.factory('userFactory', function ($http) { return { getFormData: function (callback) { $http.get('api/AngularForm').success(callback); } } |
In success event of get method, we have updated the treeview fields. Please refer the below code snippet
| [script] userFactory.getFormData(function (results) { $scope.dataList = results.localData; obj = $("#treeView").data("ejTreeView"); obj.option("fields", { id: "id", text: "name", parentId: "pid", hasChild: "hasChild", dataSource:$scope.dataList }) |
Please check the given sample let us know if it helps. If we misunderstood your queries, please provide more details about the requirement that will be easy for us to provide the exact solution
Please let us know if you have further queries,
Regards,
Sasikala Nagarajan
Attachment: TreeviewAngular_3ed99c8c.zip
Hi Rob,
Thanks for the update,
https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents
For your convenience we have prepared the workaround solution to resolve the reported issue.
By refreshing (unbind then bind) the events, after setting the fields property in treeview will resolve the issue.
Please find the below code snippet:
function getFormData() { userFactory.getFormData(function (data) { $scope.dataList = data.localData; obj = $("#treeView").data("ejTreeView"); obj.option("fields", { id: "id", text: "name", parentId: "pid", hasChild: "hasChild", dataSource: $scope.dataList }); obj._off(obj.element, 'keydown'); obj._on(obj.element, "keydown", obj._KeyPress); }) } |
Please use highlighted code in your project and let us know if you have any further queries,
Regards,
Sasikala Nagarajan
- 4 Replies
- 2 Participants
-
RO Rob ONeill
- Apr 27, 2015 11:11 AM UTC
- Apr 30, 2015 11:45 AM UTC