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

Refreshing / selecting issue

Thread ID:

Created:

Updated:

Platform:

Replies:

141855 Jan 8,2019 10:49 AM UTC Jan 14,2019 10:53 AM UTC Angular - EJ 2 3
loading
Tags: TreeGrid
Domantas
Asked On January 8, 2019 10:51 AM UTC

Hello,

I've faced an issue with remote data and tree rendering. 

So the first problem I faced is that when you execute refresh after expanding row it refreshes the grid with additional params that were added while getting child data.

Sequence: 
1) Loaded treeGrid
2) Expanding one of the grid trees

3) Executing treeGrid.refresh() function. It executed with additional params that were passed for child data to render and now whole grid is just that row child data

What I could do and I did: removed params that stayed in query and then grid will be loaded as in the first picture where parent_ID is NULL. 

Query: But what if I want grid to be expanded as it was before the refresh ? 
So there are two ways that would work:
1) Refresh grid with parent_ID null and then expand elements to where the user was (This might be slow, cause we'll need all the child data to load again) and I couldn't manage to do it with treeGrid expand methods
or
2) Refresh only that data where user was. So this is basically how it works on expanding, gets data and adds to parent, but I would want this behaviour on refresh and leave user row selection as it was.


Additional notice:

When you filter treeGrid for exmaple with menu filter. Then expanding one of the rows, the data gets duplicated.

Sequence:
1) Filtered treeGrid with menu filter where value is "test". The result I got:


2) And when I'm expanding "test" row it gets data to child and to main grid, so it gets duplicated:



 

Vignesh Natarajan [Syncfusion]
Replied On January 9, 2019 12:24 PM UTC

Hi Domantos, 

Thanks for contacting Syncfusion support. 

Query 1 : when you execute refresh after expanding row it refreshes the grid with additional params that were added while getting child data. 
 
We are able to reproduce the mentioned issue on our side. We have confirmed that the mentioned issue “Refreshing the Treegrid using refresh method after expanding a record binds the child data as datasource to the Treegrid” is a bug and have logged a defect report for the same. The fix for this issue will be included in the upcoming patch release on January 17th 2019. We appreciate your patience till then. 


Query 2: what if I want grid to be expanded as it was before the refresh ?  
 
We cannot store or detect which record is in expanded state after expanding a record. So, it is not feasible to maintain the expanded state of the records when the treegrid is refreshed.   
 
Query 3: When you filter TreeGrid for example with menu filter. Then expanding one of the rows, the data gets duplicated. 
 
Filtering feature is not supported for remote data in TreeGrid. When Filtering is enabled in the remote data we need to filter multiple levels of records from the dataSource with hierarchy relation maintained. If there are many levels, then searching and filtering the required records at all level will affect the performance of the control and so we have not provided support for remote data filtering. 

Regards, 
Vignesh Natarajan. 


Domantas
Replied On January 11, 2019 01:05 PM UTC

Hello,

Alright, so I will approach my questions differently. I assume that what I want to do is possible with workaround. So now when you expand the row for the first time it sends the query with parentID and returns child data. And for example you collapse the expanded row and expand it again. When you're expanding it again it doesn't sent query cause data is already loaded with that parentID (I assume) and it just loads it from payload. So what if I would want to get child data from database at every single expand on the same row as it executes the very first time you expand. What is the condition that decides if it should call database or load from payload, can I remove data from there on collapse to manipulate data downloading again on expand?

Query: How to manipulate child data download every time on the same row expand 

Vignesh Natarajan [Syncfusion]
Replied On January 14, 2019 10:53 AM UTC

Hi Domantas, 
 
Thanks for the update. 
 
Query: “How to manipulate child data download every time on the same row expand 
 
From your query we understand that you need to get the data from the server each time the child record are expanded. We suggest  you to achieve your requirement using Collapsed event and refresh() method of TreeGrid. Refer the below code example 
 
<ejs-treegrid #treegrid [dataSource]='data' idMapping='TaskID'  parentIdMapping='ParentItem' hasChildMapping='isParent' [treeColumnIndex]='1' allowPaging='true'  [pageSettings]='pageSetting' (collapsed)="onCollapse($event)"> 
        <e-columns> 
            <e-column field='TaskID' headerText='Task ID' width='120' textAlign='Right'></e-column> 
            <e-column field='TaskName' headerText='Task Name' width='150'></e-column> 
            <e-column field='StartDate' headerText='Start Date' width='120' format="yMd" textAlign='Right'></e-column> 
            <e-column field='EndDate' headerText='End Date' width='120' format="yMd" textAlign='Right'></e-column> 
            <e-column field='Duration' headerText='Duration' width='110' textAlign='Right'></e-column> 
            <e-column field='Progress' headerText='Progress' width='110'></e-column> 
            <e-column field='Priority' headerText='Priority' width='130'></e-column> 
        </e-columns> 
    </ejs-treegrid> 
 
 
 
onCollapse(e):void{ 
let trGrid = this.treegrid; 
trGrid.refresh(); 
    } 
 
 
 
Note: while collapsing the child data, calling the refresh method the dataSource. So everytime the parent record is expanded post will be send to server. 
 
For your convenience we have prepared a sample which can be referred from below link 
 
 
Refer our API documentation for your reference. 
 
 
 
Regards, 
Vignesh Natarajan 


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