The current behavior is expected as the isExpanded function is implemented for each node whenever the TreeView is rendered. Consequently, when we try to expand or collapse a single node the TreeView is re-rendered and the isExpanded function returns true or false for all of the nodes.
Probably a more suitable solution would be to use the expandedKeys and expandBy properties of the kendoTreeViewExpandable
directive in order to achieve the desired functionality. We can compute all of the parent nodes text properties:
public allParentNodes = ;
and pass these to the expandedKeys property when we need to expand all nodes:
//the slice method is used in order to return a new array instance so that the TreeView is re-rendered
Here is the complete demo:
I hope this helps.
Get quickly onboarded and successful
with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.