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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

132493 Sep 5,2017 06:56 AM Sep 7,2017 12:34 PM Angular 1
loading
Tags: ejTreeGrid
Naresh K
Asked On September 5, 2017 06:56 AM

Hi,

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,
NareshK

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

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,  
[html] 
<ej-treegrid #TreeGridControl [dataSource]="datasource" [treeColumnIndex]=1 
        idMapping = "TaskID" parentIdMapping="ParentID" hasChildMapping="isParent" 
        enableVirtualization = "true" enableLoadOnDemand="true" 
        sizeSettings.height="450px" sizeSettings.width="100%" > 
//… 
</ej-treegrid> 
 
[Ts] 
 
    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.  
Regards, 
Jayakumar D 


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.

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.

;