We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Dynamically hiding and showing tree node ?

- is there a way to dynamically hide and show tree nodes ?
( like a tree node property based binding of visibility ) ?

3 Replies

SP Sowmiya Padmanaban Syncfusion Team December 17, 2019 06:34 AM

Hi Yordon, 
Thanks for contacting Syncfusion support. 
We have checked your reported query about show/hide the TreeView node. Currently , we have not provided API for hide the TreeView node. However, we can achieve your requirement in unique work around approach. In TreeView component, we have provided a method EnableNodes() and DisableNodes(). When calling this method, we have internally added the unique class to the specific treeview node element. Based on this class we can customize the element visibility to meet your requirement.  
To perform this, you can pass the array of id (node id) in this method and also set the display as none for disable node in CSS level.  
Refer the below code snippet. 
   public void DisableNode(System.EventArgs args) 
    public void EnableNode(System.EventArgs args) 
    #treeview .e-list-item.e-disable > .e-fullrow, 
    #treeview .e-list-item.e-disable > .e-text-content { 
        display: none; 
We have prepared a sample for your reference. In that sample, we can show and hide the node using button click. 
To know more about the TreeView component, Refer the below links. 
Please let us know, if you have any concerns. 

YO Yordan December 17, 2019 08:12 AM

Absolutely great ! Thank You dear support !

SP Sowmiya Padmanaban Syncfusion Team December 18, 2019 01:08 AM

Hi Yordon, 
Most welcome. We are glad to hear that the provided solution helped you to achieve your requirement. Please get back to us if you need any further assistance on this. 

Live Chat Icon For mobile
Up arrow icon