Articles in this section
Category / Section

How to refresh the data in EJ2 TreeView?

1 min read

In our TreeView component, the fields property has been provided to set or get the data source and other data related information. You can use this property to dynamically change the TreeView component data source. The following code demonstrates how to update data source for TreeView.

 

Typescript

 
let treeInstance: TreeView = getComponent(document.querySelector('#tree'),'treeview');
 
treeInstance.fields = { dataSource: hierarchicalData, id: 'id', text: 'name', child:'subChild' }; 
 

 

Samplehttps://stackblitz.com/edit/nzip6j-bvsvsv?file=index.ts 

 

Javascript:

 
var treeInstance = ej.base.getComponent(document.querySelector('#tree'),'treeview');
 
treeInstance.fields = { dataSource: hierarchicalData, id: 'id', text: 'name', child:'subChild' }; 
 

 

Samplehttps://stackblitz.com/edit/iuglw8?file=index.js

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied