Category / Section
How to refresh the data in EJ2 TreeView?
1 min read
This article explains how to refresh the data in the EJ2 TreeView.
In our TreeView component, the fields property is provided to set or get the data source and other data-related information. You can use this property to dynamically change the TreeView component's data source. The following code demonstrates how to update the data source for TreeView.
Typescript
let treeInstance: TreeView = getComponent(document.querySelector('#tree'),'treeview'); treeInstance.fields = { dataSource: hierarchicalData, id: 'id', text: 'name', child:'subChild' };
Refer to the working sample for additional details and implementation: Sample
Javascript:
var treeInstance = ej.base.getComponent(document.querySelector('#tree'),'treeview'); treeInstance.fields = { dataSource: hierarchicalData, id: 'id', text: 'name', child:'subChild' };
Refer to the working sample for additional details and implementation: Sample