collapse

Collapses nodes.

Example

<div id="treeview"></div>
<script>
$("#treeview").kendoTreeView({
  dataSource: [
    { text: "foo", expanded: true, items: [
      { text: "bar" }
    ] },
    { text: "baz", expanded: true, items: [
      { text: "qux" }
    ] }
  ]
});

var treeview = $("#treeview").data("kendoTreeView");
// collapse the item with text "foo"
treeview.collapse(treeview.findByText("foo"));

// collapse all items
treeview.collapse(".k-item");
</script>

Parameters

nodes jQuery|Element|String

The nodes that will be collapsed.

In this article