Monday, 15 April 2013

kendo ui - KendoUI TreeView in AngularJS: how to load complete HierarchicalDataSource in a single server request? -



kendo ui - KendoUI TreeView in AngularJS: how to load complete HierarchicalDataSource in a single server request? -

i have coded kendoui/angularjs treeview makes server request retrieve json data. problem first node shown in tree, though json response contains total tree.

i read here since tree uses hierarchicaldatasource there's workaround fetch finish tree. workaround not in angularjs , cannot figure out how implement loading tree k-options attribute. how load , show finish tree in single request?

this html:

<div ng-controller="ctrl"> <div id="treediv" kendo-tree-view="tree" k-options="treeoptions"></div> </div>

and javascript:

app.controller('ctrl', ['$scope','$http', function($scope,$http) { $scope.treeoptions = { datasource: { transport: { read: function (e) { $http({ method: 'get', url: '/loadtree', headers: { 'content-type': 'application/json' } }). success(function(data, status, headers, config) { e.success(data.tree); }). error(function(data, status, headers, config) { alert('system error'); }); } } } }; }]);

the reply implement init function in controller populate finish info source (i.e. via $http) before tree loaded.

angularjs kendo-ui kendo-treeview

No comments:

Post a Comment