detach

Removes a node from a TreeView, but keeps its jQuery.data() objects.

Parameters

node jQuery|Element|String

The node that is to be detached.

Returns

jQuery The node that has been detached.

Example - remove the node with ID, firstItem

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

var treeview = $("#treeview").data("kendoTreeView");
var item = treeview.findByText("foo");
item.data("id", "abc");
treeview.detach(item);
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(item.data("id")); // logs "abc"
</script>
In this article