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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Dynamically hiding and showing tree node ?

Thread ID:

Created:

Updated:

Platform:

Replies:

149967 Dec 16,2019 02:02 PM UTC Dec 18,2019 06:08 AM UTC Blazor 3
loading
Tags: TreeView
Yordan
Asked On December 16, 2019 02:02 PM UTC

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

Sowmiya Padmanaban [Syncfusion]
Replied On December 17, 2019 11:34 AM UTC

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) 
    { 
        tree.DisableNodes("['3']"); 
    } 
    public void EnableNode(System.EventArgs args) 
    { 
        tree.EnableNodes("['3']"); 
    } 
 
<style> 
    #treeview .e-list-item.e-disable > .e-fullrow, 
    #treeview .e-list-item.e-disable > .e-text-content { 
        display: none; 
    } 
</style> 
 
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. 
 
 
Regards, 
Sowmiya.P 


Yordan
Replied On December 17, 2019 01:12 PM UTC

Absolutely great ! Thank You dear support !

Sowmiya Padmanaban [Syncfusion]
Replied On December 18, 2019 06:08 AM UTC

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. 
 
Regards, 
Sowmiya.P 
  
  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon