Use the expand
method as shown in the TreeView API reference.
$(document).ready(function () {
var treeview = $("#refModelTreeView").data("kendoTreeView");
treeView.expand(".k-item");
});
Question
How do I go about loading the treeview with all the parents and children. Right now it loads only the Parents and then loads each child when you click.
@(Html.Kendo().TreeView()
.Name("refModelTreeView")
.DataTextField("Name")
.HighlightPath(true)
.DataSource(datasource => datasource
.Read(read => read
.Action("LoadTreeView", "ReferenceModel").Data("addData")
)
)
Solution
Use the expand
method as shown in the TreeView API reference.
$(document).ready(function () {
var treeview = $("#refModelTreeView").data("kendoTreeView");
treeView.expand(".k-item");
});