removeRow
Removes the specified table row from the TreeList. Also removes the corresponding data item from the data source. Fires the remove event.
Parameters
row String|Element|jQuery
A string, a DOM element, or a jQuery object which represents the table row. A string is treated as a jQuery selector.
Example - removing the first table row
<button id="btn">Remove second row</button>
<div id="treelist"></div>
<script>
var dataSource = new kendo.data.TreeListDataSource({
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
}
}
});
$("#treelist").kendoTreeList({
dataSource: dataSource,
toolbar: [ "create" ],
editable: "popup",
height: 540,
columns: [
{ field: "FirstName", expandable: true, title: "First Name", width: 250 },
{ field: "LastName", title: "Last Name" },
{ field: "Position" }
]
});
$("#btn").click(function(){
var treelist = $("#treelist").data("kendoTreeList");
treelist.removeRow($("#treelist tbody>tr:nth(1)"));
});
</script>