Edit this page

expandTo

Expands all nodes up to a given element. The element needs to be already loaded.

Parameters

targetNode kendo.data.Node |Object

The dataItem of the node up to which to expand. Can also be the node ID

Example

<div id="treeview"></div>
<script>
$("#treeview").kendoTreeView({
  dataSource: [
    { id: 1, text: "foo", items: [
      { id: 2, text: "bar", items: [
        { id: 3, text: "baz" }
      ] }
    ] },
    { text: "one", items: [
      { text: "two", items: [
        { text: "three" }
      ] }
    ] }
  ]
});

var treeview = $("#treeview").data("kendoTreeView");

// expand all nodes up to "baz" (with id = 3)
treeview.expandTo(3);


// expand all nodes up to "three"
var three = treeview.dataItem(treeview.findByText("three"));
treeview.expandTo(three);

</script>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy