Grid's displayed data not updating with virtualization enabled

Hello,

We have a Grid which is bound to an ef core datasource through a custom adaptor.

Currenty there are 900.000 rows in the db, so we have virtualization enabled (50 pagesize) and everything is working nice and fast.
There is the need to clear the whole table and for performance reasons we truncate the table though a direct sql command. 
This is achieved with a custom button in toolbar (Clear Table)



The problem is that after truncation, we call the table's Refresh and although we can see that the CurrentViewData is empty, the initial 50 rows that were loaded on initialization are still appearing.
StateHasChanged will not do anything, only a page reload will display the (now empty) table.

As far as we know it is not possible to select all rows (not just the loaded ones) throught the checkbox and delete them through the integrated batch edit action. (which might also raise perfomance concerns).

Is this a problem on our end? How can we tackle this?

Component version: Latest as of 9th of October 2020.

Best Regards,
Chris

5 Replies 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team October 12, 2020 02:29 PM UTC

Hi Chris, 

Greetings from Syncfusion support. 

We are not clear about the exact scenario you are facing the reported problem. We tried by creating a sample by dynamically modifying Grid’s DataSource. But we are not able to face the reported problem. Grid displays empty in the sample prepared from our side. We are attaching the sample for your reference. Please download the sample from the link below, 
 
Kindly refer the above attached sample, and if we have misunderstood your query or if you are still facing difficulties, then the following details would be helpful for us to proceed further on this. 
  1. Share a simple issue reproducing sample, or if possible reproduce the problem with the attached sample and share with us for further analysis.
  2. Share the complete Grid rendering codes and the datasource changing codes. Are you calling Grid’s Refresh() method?
  3. Share a video demo showing the problem you are facing.
  4. Share the exact scenario or proper replication procedure.


Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 



CH Christos October 26, 2020 01:47 PM UTC

Good evening,

Thank you for your reply and time.

The issue on our end was that we did not reassign a new/empty source as the Grids Datasource.

We expected that after clearing the already attached datasource (whether it is an IQueryable or a simple List) and calling Grid.Refresh() would reload the (now empty) data.

The "issue" can be also observed in your example. By obtaining a reference to the List and calling List.Clear(), the initial "cached" data are still desplayed.
They will dissappear once we scroll down enough to cause the Virtualization Mechanism to fetch the next x rows, which are now not available, since the list is empty.
If we disable virtualization, the grid clears successfully. Probably virtualization uses a buffer somewhere in the middle that is not cleared(?)

I am attaching the modified version of your example, to demonstrate the "issue".

We resolved the issue per your suggestion, just leaving this here should anyone encounter the same.

Thank you again for your time,
Chris 

Attachment: ServersampleModified_248b5652.7z


RS Renjith Singh Rajendran Syncfusion Team October 27, 2020 10:56 AM UTC

Hi Christos, 

Based on this scenario, we suggest you to call the Refresh method inside the DataBound event handler of Grid. Please refer and use as like the codes below, 

 
<GridEvents DataBound="DataBound" OnToolbarClick="OnToolbarClick" TValue="Order"></GridEvents> 

public void DataBound(){    if (flag)    {        myGrid.Refresh();        flag = false;    }}public async Task OnToolbarClick(ClickEventArgs args){    if(args.Item.Text == "ClearTable")    {        Orders.Clear();        flag = true;        myGrid.Refresh();    }}

We have also modified the sample for your convenience, please download the sample from the link below, 
 
 
Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 


Marked as answer

CH Christos October 29, 2020 07:03 AM UTC

Hello Renjith,

Just to confirm that the solution you provided, solved our problem.

Many thanks for your time.

Best Regards,
Chris


RS Renjith Singh Rajendran Syncfusion Team October 30, 2020 12:07 PM UTC

Hi Chris, 

We are glad to hear that the provided suggestion helped you in achieving your requirement. 

Please get back to us if you need further assistance. 

Regards, 
Renjith R 


Loader.
Up arrow icon