Prepares the widget for safe removal from DOM. Detaches all event handlers and removes attributes to avoid memory leaks. Calls the destroy method of any child Kendo UI widgets.

This method does not remove the widget element from the DOM.

Example - safely removing the TreeList from the DOM

<button id="destroy">Destroy and remove TreeList</button>
<div id="treeList"></div>
    columns: [
      { field: "name" },
      { field: "age" }
    dataSource: [
      { id: 1, parentId: null, name: "Jane Doe", age: 22, expanded: true },
      { id: 2, parentId: 1, name: "John Doe", age: 24 },
      { id: 3, parentId: 1, name: "Jenny Doe", age: 3 }
    $("#treeList").data("kendoTreeList").destroy(); // destroy the TreeList

    $("#treeList").remove(); // remove all TreeList HTML
In this article
Not finding the help you need? Improve this article