expandPath
Expands all nodes from a provided path array, including the last node. Nodes may be loaded from a remote end-point.
Parameters
path Array
The IDs of the nodes that need to be expanded.
complete Function
Callback function that will be called once the path has been expanded.
Example
<div id="treeview"></div>
<script>
$("#treeview").kendoTreeView({
dataSource: [
{ id: 1, text: "foo", items: [
{ id: 2, text: "bar", items: [
{ id: 3, text: "baz" }
] }
] }
]
});
var treeview = $("#treeview").data("kendoTreeView");
// expand the path of nodes with IDs 1, 2, and 3
treeview.expandPath([1, 2, 3]);
</script>
Example of expanding a remote loaded path
<button class="k-button">Expand</button>
<div id="treeview"></div>
<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({
dataSource: datasource,
dataTextField: "FullName"
});
$("button").click(function() {
var treeview = $("#treeview").data("kendoTreeView");
treeview.expandPath([2, 5]);
});
</script>