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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Can add nested nodes with addNodes() method?

Thread ID:





141182 Nov 28,2018 04:13 PM UTC Dec 5,2018 03:59 PM UTC Angular - EJ 2 3
Tags: Treeview
Jon Andoni
Asked On November 28, 2018 04:13 PM UTC


I´m following the next example of "How to process the node operation in tree view using context menu" here: https://ej2.syncfusion.com/angular/documentation/treeview/how-to/#how-to-process-the-node-operation-in-tree-view-using-context-menu .
I probe by myself the same code changing item like this to add a nested item:
let item: { [key: string]: Object } = { id: nodeId, name: "New Folder", child: {id: 5, name: "Folder"} };
and doesn´t work, there is any solution?


Christopher Issac Sunder K [Syncfusion]
Replied On November 29, 2018 10:52 AM UTC

Hi Jon Andoni, 

Thank you for contacting Syncfusion support. 

As per our analysis, the reported problem may occur due to the improper mapping on fields to form the data. Could you please ensure the mapping fields specification at your end? 

Here is the sample code for your reference,  

public onClick(){ 
    let item: { [key: string]: Object } = { id: "node1", name: "New Folder", hasChildren: true, subChild: [{ id: 5, name: "Folder" }] }; 
    this.tree.addNodes([item], this.tree.selectedNodes[0]); 

Please get back to us with more details if you are facing the same issue still. 


Jon Andoni
Replied On November 29, 2018 01:23 PM UTC

Hello Christo,

Thanks for the solution, it works well ;)

Christopher Issac Sunder K [Syncfusion]
Replied On November 30, 2018 05:38 AM UTC

Hi Jon Andoni, 

We are glad to hear that the provided solution worked for you. Have a great day!!! 



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