Piyush Barua
Piyush Barua

Reputation: 137

How can I delete child nodes of selected node in telerik kendo treeview

enter image description here

I want to remove all child of selected node like highlighted div in image.

Upvotes: 0

Views: 909

Answers (1)

DontVoteMeDown
DontVoteMeDown

Reputation: 21465

Try this snippet:

var tv = $("#treeview").data("kendoTreeView");

$(tv.element).find('input[type="checkbox"]:checked').each((i, item) =>
{
      $(item).closest("li").find("ul li").each((i, removeItem) => tv.remove(removeItem));
});

It finds all checked checkboxes and remove its children.

Demo

Upvotes: 1

Related Questions