Cannot get TreeData after addNode()

Hey. I use the TreeView component

<ejs-treeview #tree id="tree" [fields]='field' [allowEditing]='allowEditing' >ejs-treeview>

  public field:Object ={ dataSource:  this.data, id: 'uuid', text: 'name', child: 'children' };

Im adding a node with this function:

public addNode(event) {
let item: { [key: string]: Object } = {id:this.count, name: "Neue Kategorie"};
this.tree.addNodes([item], this.tree.selectedNodes[0]);
++this.count;
}


If I now try to change the name of the node, I get "undefined" in "oldText", when I click on the node.

01.PNG


After changing the name I try to get the current data with the function getTreeData(). There I get only an object with the initial data from addNode() 02.PNG


If I fill the variable field only with the DataSource, adding, changing and data retrieval works using getTreeData()


Thanks for considering my request


1 Reply

LD LeoLavanya Dhanaraj Syncfusion Team May 19, 2022 01:45 PM UTC

Hi Philipp,


Greetings from Syncfusion support.


We understand that after adding a new node and editing that node in the TreeView item, you want to get the updated data source. For your reference, we have prepared a TreeView sample. Here, we are adding the node and while editing, we get the node's oldText using the nodeEditing event. Then retrieve the updated data source using the getTreeData method. In our sample, we were not able to replicate the reported issue.


Refer the sample from below link.


Sample : https://stackblitz.com/edit/angular-wugk5x?file=app.component.html,app.component.ts


If the issue still persists, kindly replicate the issue in the above shared sample and share with us the package version of the Syncfusion components. These details would help us assist you promptly.


Regards,

Leo Lavanya Dhanaraj


Loader.
Up arrow icon