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

How to use fetched data in TreeViewTemplates

Thread ID:





146080 Jul 18,2019 09:13 PM UTC Aug 2,2019 03:22 PM UTC Blazor 2
Tags: TreeView
Asked On July 18, 2019 09:13 PM UTC

I'm fetching data from a serverside controller using an UrlAdaptor. How can I use the returned data in a TreeViewTemplates.
I tried this but it does not work:

<EjsTreeView id="tree" ModelType="@modelType" LoadOnDemand="true">
                        <img class="eimage" src="@context.IconURL" alt="employee" />
                        <span class="treeName">@context.Name</span>

public StructureItem modelType = new StructureItem();
    public class StructureItem
        public string StructureNodeID { get; set; }
        public string ParentID { get; set; }
        public string Name { get; set; }
        public string IconURL { get; set; }
        public bool HasChildren { get; set; }
        public bool expanded { get; set; }

Best Regards

Kanagambigai Murugan [Syncfusion]
Replied On July 19, 2019 12:49 PM UTC

Hi Mike, 
Sorry for the inconvenience caused. 
Currently we have issues in TreeView templates while enabling LoadOnDemand feature. We have logged a bug report regarding this and we are working on this with high priority. We will fix this issue in our upcoming patch release which is expected to be rolled out on 1st August, 2019. Until then, we appreciate your patience. 
You can track the status of this bug report in the following link: 
Please let us know if you have any queries. 
Kanagambigai M. 

Kanagambigai Murugan [Syncfusion]
Replied On August 2, 2019 03:22 PM UTC

Hi Mike, 

We are glad to inform that our latest ( NuGet release has been rolled out and your reported defect has been resolved in this version. We have prepared a sample to render the TreeView using templates with LoadOnDemand enabled. 

<EjsTreeView  TValue="StructureItem" ModelType="@modelType"> 
    <TreeViewFieldsSettings TValue="StructureItem" Query="new ej.data.Query().addParams('ParentID','5')" Id="employeeID" Text="firstName" HasChildren="employeeID"> 
            <EjsDataManager Url="/api/Default" Adaptor="Syncfusion.EJ2.Blazor.Adaptors.UrlAdaptor" CrossDomain="true"></EjsDataManager> 
            <TreeViewFieldChild TValue="StructureItem" Id="orderID" Text="firstName" ParentID="employeeID" Expanded="expanded"> 
                <EjsDataManager Url="api/Child" Adaptor="Syncfusion.EJ2.Blazor.Adaptors.UrlAdaptor" CrossDomain="true"></EjsDataManager> 
                        var templateData = (@context as StructureItem); 
                            <div class="treeviewdiv"> 
                                <div style="float:left"> 
                                    <span class="treeName">@templateData.FirstName</span> 

Since we have some major changes in this release, kindly go through the following release notes 

Please let us know if you need any further assistance. 

Kanagambigai M. 


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