Reputation: 121
I have a kendo treeview HierarchicalDataSource like this.
treeViewData = new kendo.data.HierarchicalDataSource({
transport: {
read: {
url: getTreeData,
cache: false,
dataType: "json"
}
},
schema: {
model: {
//To bind child items for parent nodes
children: "items",
id: "NodeId"
},
}
});
How can I find out when the treeview has finished loading?
Thanks in Advance.
Upvotes: 1
Views: 2155
Reputation: 1638
In 2022 Kendo Treeview added LoadCompleted function to notify the tree is loaded completely.
loadCompleted: function (ev) {
console.log("Load Completed: ", ev.nodes);
}
The full source code
<script>
var dataSource = new kendo.data.HierarchicalDataSource({
transport: {
read: {
url: "https://demos.telerik.com/kendo-ui/service/Employees",
dataType: "jsonp"
}
},
schema: {
model: {
id: "EmployeeId",
hasChildren: "HasEmployees"
}
}
});
$("#treeview").kendoTreeView({
loadOnDemand: false,
dataSource: dataSource,
dataTextField: "FullName",
loadCompleted: function (ev) {
console.log("Load Completed: ", ev.nodes);
}
});
</script>
<div id="treeview"></div>
Upvotes: 0
Reputation: 11
You can do this:
var treeview = $("#treeview").data("kendoTreeView");
treeview.dataSource.read().then(function () {
//bound
});
The function is called only once - when the data binding to the TreeView
is completed. Instead of //bound
, you need to write the code that should be executed after the end of data binding.
Upvotes: 1
Reputation: 555
You can put in your kendoTreeView Configuration event "databound" something like but this is Fired when the widget is bound to data from its data source.
$("#treeview").kendoTreeView({
dataSource: treeViewData,
dataBound: function(e) {
//bound
}
});
but probably you hant some Jquery function?
somthing like:
$("#treeview").find()
Hope this help
Upvotes: 1