Is this the proper way of updating the data for a kendo treeview? If that's the case, then why am I getting some major memory leaks (according to Chrome's allocation profile)? And when I say 'major', I mean relative to our tiny sample data, obviously :).
Am I missing something?
Dojo: http://dojo.telerik.com/EyuwU/3
Am I missing something?
<!DOCTYPE html>
<
html
>
<
head
>
<
title
></
title
>
<
link
rel
=
"stylesheet"
href
=
"https://kendo.cdn.telerik.com/2016.2.714/styles/kendo.common.min.css"
/>
<
link
rel
=
"stylesheet"
href
=
"https://kendo.cdn.telerik.com/2016.2.714/styles/kendo.default.min.css"
/>
<
link
rel
=
"stylesheet"
href
=
"https://kendo.cdn.telerik.com/2016.2.714/styles/kendo.default.mobile.min.css"
/>
<
script
src
=
"https://code.jquery.com/jquery-3.1.0.min.js"
integrity
=
"sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s="
crossorigin
=
"anonymous"
></
script
>
<
script
src
=
"https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"
></
script
>
<
script
src
=
"https://kendo.cdn.telerik.com/2016.2.714/js/kendo.all.min.js"
></
script
>
</
head
>
<
body
>
<
div
id
=
"example"
ng-app
=
"KendoDemos"
>
<
div
ng-controller
=
"MyCtrl"
>
<!-- generate new data and update the datasource-->
<
button
ng-click
=
"generate()"
>Generate</
button
>
<
div
kendo-tree-view
=
"treeApi"
k-data-text-field
=
"'name'"
k-data-source
=
"datasource"
k-load-on-demand
=
"false"
>
</
div
>
</
div
>
</
div
>
<
script
>
angular.module("KendoDemos", [ "kendo.directives" ])
.controller("MyCtrl", function($scope) {
$scope.datasource = new kendo.data.HierarchicalDataSource({
sort: { field: "name", dir: "asc" },
data: [],
schema: {
model: {
id: 'id',
children: 'items'
}
}
});
$scope.generate = function() {
var data = [{
id: 1,
name: 'name',
items: [{
id: 2,
name: 'name',
items: [{
id: 3,
name: 'name',
items: [{
id: 4,
name: 'name',
items: []
}]
}]
}, {
id: 5,
name: 'name',
items: [{
id: 6,
name: 'name',
items: [{
id: 7,
name: 'name',
items: []
}]
}]
}]
}];
$scope.datasource.data(data);
};
$scope.generate();
});
</
script
>
</
body
>
</
html
>
Dojo: http://dojo.telerik.com/EyuwU/3