remove

Fires when the user clicks the Destroy command button. The event handler function context (available through the this keyword) will be set to the widget instance.

Event Data

e.model kendo.data.TreeListModel

The data item to which the table row is bound.

e.row jQuery

The jQuery object which represents the current table row.

e.sender kendo.ui.TreeList

The widget instance which fired the event.

e.preventDefault Function

If invoked, prevents the removal of the data item. The table rows will remain unchanged.

Example - subscribing to the remove event before initialization

<div id="treelist"></div>
<script>

  $("#treelist").kendoTreeList({
    dataSource: {
      transport: {
        read: {
          url: "https://demos.telerik.com/kendo-ui/service/EmployeeDirectory/All",
          dataType: "jsonp"
        },
        destroy: {
          url: "https://demos.telerik.com/kendo-ui/service/EmployeeDirectory/Destroy",
          dataType: "jsonp"
        },
        parameterMap: function(options, operation) {
          if (operation !== "read" && options.models) {
            return {models: kendo.stringify(options.models)};
          }
        }
      },
      batch: true,
      schema: {
        model: {
          id: "EmployeeId",
          parentId: "ReportsTo",
          fields: {
            EmployeeId: { type: "number", editable: false, nullable: false },
            ReportsTo: { nullable: true, type: "number" },
            HireDate: {type: "date"},
            BirthDate: {type: "date"}
          },
          expanded: true
        }
      }
    },
    toolbar: [ "create" ],
    editable: "popup",
    height: 540,
    columns: [
      { field: "FirstName", expandable: true, title: "First Name", width: 250 },
      { field: "LastName", title: "Last Name" },
      { field: "Position" },
      { command: ["destroy"] }
    ],
    remove: function(e) {
/* The result can be observed in the DevTools(F12) console of the browser. */
      console.log("remove");
    }
  });
</script>

Example - subscribing to the remove event after initialization

<div id="treeList"></div>
<script>

  $("#treeList").kendoTreeList({
    dataSource: {
      transport: {
        read: {
          url: "https://demos.telerik.com/kendo-ui/service/EmployeeDirectory/All",
          dataType: "jsonp"
        },
        destroy: {
          url: "https://demos.telerik.com/kendo-ui/service/EmployeeDirectory/Destroy",
          dataType: "jsonp"
        },
        parameterMap: function(options, operation) {
          if (operation !== "read" && options.models) {
            return {models: kendo.stringify(options.models)};
          }
        }
      },
      batch: true,
      schema: {
        model: {
          id: "EmployeeId",
          parentId: "ReportsTo",
          fields: {
            EmployeeId: { type: "number", editable: false, nullable: false },
            ReportsTo: { nullable: true, type: "number" },
            HireDate: {type: "date"},
            BirthDate: {type: "date"}
          },
          expanded: true
        }
      }
    },
    toolbar: [ "create" ],
    editable: "popup",
    height: 540,
    columns: [
      { field: "FirstName", expandable: true, title: "First Name", width: 250 },
      { field: "LastName", title: "Last Name" },
      { field: "Position" },
      { command: ["destroy"] }
    ]
  });

  function remove(e) {
/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log("remove");
  }

  var treeList = $("#treeList").data("kendoTreeList");
  treeList.bind("remove", remove);
</script>
In this article