Adding Node

Hi,

When I add nodes in my treeview component, the node aren´t available to select.

How correctly add nodes in treeview in version 18.0.41?

4 Replies 1 reply marked as answer

SP Sowmiya Padmanaban Syncfusion Team October 16, 2020 12:06 PM UTC

Hi Felipe,  
 
Greetings from Syncfusion support. 
 
In our latest version(18.3.41), we have provided a support for adding the nodes directly to the datasource of TreeView component. Refer the release notes below. 
 
 
Refer the below code snippet. 
 
  public void Click() 
    { 
        MyFolder.Add(new MailItem 
        { 
            Id = "5", 
            ParentId = "2", 
            FolderName = "Music" 
        }); 
        selectedNodes = new string[] { "5" }; 
    } 
 
 
Refer the sample link below. 
 
 
Refer to the below link to know more about the TreeView component. 
 
 
 
 
Please let us know, if you need any further assistance. 
 
Regards,  
Sowmiya.P 



FE Felipe October 16, 2020 04:10 PM UTC

Thank you for reply, but I my treeview is not good.

When I add a node, the tree don´t refresh automatically

See the included file

Attachment: Index_5f030223.rar


SP Sowmiya Padmanaban Syncfusion Team October 19, 2020 07:43 AM UTC

Hi  Felipe,  
 
We have checked your reported issue with TreeView component. We have considered this as a  bug from our end. We will fix this issue and include the fix in our upcoming patch release which is expected to be rolled out by the end of October 2020. 
 
You can track the following feedback portal link to know the status of this bug. 
 
 
We appreciate your patience. 
 
Regards, 
Sowmiya.P 



SP Sowmiya Padmanaban Syncfusion Team October 28, 2020 07:48 AM UTC

Hi Felipe,  
 
We are glad to announce that our patch release (V18.3.44) is rolled out successfully. In this release, we have included fix  for “TreeView UI updated based on collection value”. To access this fix, we suggest you to update the package to the latest version (V18.3.44). 
 
You need to manually expand the corresponding node, when adding the node to the TreeView component . Refer the below code snippet. 
 
    // To add a new node 
    async Task AddNodes() 
    { 
        this.tree.ExpandAll( new string[] { this.selectedId }); 
        string NodeId = "tree_" + this.index.ToString(); 
        ListData.Add(new EmployeeData 
        { 
            Id = NodeId, 
            Name = "NewItem", 
            Pid = this.selectedId 
        }); 
        await Task.Delay(100); 
        await this.tree.BeginEdit(NodeId); 
        this.index = this.index + 1; 
 
    } 
 
 
Refer the sample link below. 
 
 
Please get in touch with us if you would require any further assistance. 
 
Regards, 
Sowmiya.P 


Marked as answer
Loader.
Up arrow icon