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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Load data dynamically from database when click on expand icon in treeGrid control

Thread ID:





132493 Sep 5,2017 10:56 AM UTC Sep 7,2017 04:34 PM UTC Angular 1
Tags: ejTreeGrid
Naresh K
Asked On September 5, 2017 10:56 AM UTC


I'm using treegrid with angular & typescript to display hierarchical data. 
Initially I only load parent data using a service call (say getParents() method), which return much fewer json records.

Requirement is:
If user click expand icon for one parent record, it should make a service call for other method (say getChilds()) to get children records for the parent record and display them in treegrid control.

Please confirm if this is achievable in syncfusion using angular.
If yes, please provide me an example.

thanks in advance,

Jayakumar Duraisamy [Syncfusion]
Replied On September 7, 2017 04:34 PM UTC

Hi Naresh, 
We have analyzed your given requirement and it can be achieved in TreeGrid by using load on demand support. To enable “Load on Demand” feature, we required “hasChildMapping” API to identify the parent node and “enableLoadOnDemand” as true.  
At initial, TreeGrid loaded with parent/root nodes in collapsed state from the remote server by using dataManager. After expand the parent record, corresponding child records are fetched from the webservice and added to respective parent record.  
As we are using remote data, so we should be either mention crossDomain as true in DataManager or use enableLoadOnDemand as true.  
Please refer following code snippet,  
<ej-treegrid #TreeGridControl [dataSource]="datasource" [treeColumnIndex]=1 
        idMapping = "TaskID" parentIdMapping="ParentID" hasChildMapping="isParent" 
        enableVirtualization = "true" enableLoadOnDemand="true" 
        sizeSettings.height="450px" sizeSettings.width="100%" > 
    public datasource = new ej.DataManager({ 
            crossDomain: true 
Please refer following document & online sample links,  
We have also prepared a demo sample with remote data from online webservice. Please find the sample location as below,  
Please let us know, if you require any other assistance.  
Jayakumar D 


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