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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use fetched data in TreeViewTemplates

Thread ID:

Created:

Updated:

Platform:

Replies:

146080 Jul 18,2019 09:13 PM UTC Aug 2,2019 03:22 PM UTC Blazor 2
loading
Tags: TreeView
MikeR
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">
            <TreeViewTemplates>
                <NodeTemplate>
                    <div>
                        <img class="eimage" src="@context.IconURL" alt="employee" />
                        <span class="treeName">@context.Name</span>
                    </div>
                </NodeTemplate>
            </TreeViewTemplates>

Code:
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
Mike

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. 
  
Regards, 
Kanagambigai M. 


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

Hi Mike, 

We are glad to inform that our latest (17.2.0.40-beta) 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> 
            </TreeViewFieldChild> 
        </TreeViewFieldsSettings> 
        <TreeViewTemplates> 
                <NodeTemplate> 
                    @{ 
                        var templateData = (@context as StructureItem); 
                        <div> 
                            <div class="treeviewdiv"> 
                                <div style="float:left"> 
                                    <span class="treeName">@templateData.FirstName</span> 
                                </div> 
                            </div> 
                        </div> 
                    } 
                </NodeTemplate> 
            </TreeViewTemplates> 
</EjsTreeView> 


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. 

Regards, 
Kanagambigai M. 
 


CONFIRMATION

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