@ViewChild("treeview", { static: false }) public treeview;public expandedKeys: any[] = ["0"];
public isItemExpanded = (_: any, index: string) =>this.expandedKeys.indexOf(index) > -1;public nodeClick(e) {
var item = e.item.dataItem;
var index = e.item.index;
if (this.isItemExpanded(item, index)) {
this.treeview.collapseNode(item, index);
} else {
this.treeview.expandNode(item, index);
}
}
In this StackBlitz example, the Kendo UI TreeView nodes expand and collapse when you click on the node.
I hope this helps Please let me know if I can further assist you.
Regards,
Hetali
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.