The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I am using Javascript/HTML/CSS and wish to start the web site with a blank Treeview, then when receiving data from our server wish to add the nodes. I dont want to bind the data automatically, I plan to receive JSON data (some of the data not for the TreeView) add it into a buffer then display the tree. Is there an example of creating and displaying an empty treeview, then for example by pressing a button the data is added?
SPSowmiya Padmanaban Syncfusion Team December 24, 2019 05:59 AM
Hi Neil,
Greetings from Syncfusion support.
We have checked your reported query that dynamically add the data to the TreeView component. To achieve your requirement, initially set the dataSource property as empty for TreeView component and add the dataSource during button click. Refer the below code snippet for dynamically add dataSource.
document.getElementById('add').onclick = () => {
treeObj.fields.dataSource = (dataSource as any).defaultData;
}
We have prepared a sample for your reference. In that sample, we load the dataSource dynamically. Refer the sample link below.
PGPon Geetha A J Syncfusion Team December 25, 2019 11:40 PM
Hi
Can this be done in Javascript/html instead of a ts file?
Regards
Neil
________________________________________________
Hi
Many thanks for below. It works great, but what is the .ts file extension? I tried to place it in my javascript file but it mentions it can only be placed in a ts file
Best Regards
Neil
SAShameer Ali Baig Sulaiman Ali Baig Syncfusion Team December 31, 2019 04:02 AM
Hi Neil,
Yes, you can use EJ2 TreeView in JavaScript. For your convenience, we have modified the previously provided sample for JavaScript platform.