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. Image for the cookie policy date

Problems with async OnDemandLoading.

Hi there.

I've spent the last few days, trying to change my app loading thousands of rows at once to use OnDemandPaging.

This worked like a charm, until I made the method which reads (and searches) through thousands of records async. Not the SfDataPager is not working properly.

I've made and attached a sample, which runs in three modes. (Change the mode by commenting/uncommenting lines 30-32). I've put in a 200 ms delay in the GetData-methods, to simulate the search.

DemoMode.Sync:
Grid works fine, but UI freezes during search (in real life - had to remove the Task.Delay() here, because it just triggered the error.

DemoMode.Async:
Grid initially seems empty. Going to the next page, just shows empty cells. (Rows without values). Going back shows the values. Going to the next page gives the new values.

DemoMode.AsyncFix
Fixes the problem, by refreshing the PagedSource property on the pager. But this is not acceptable because of the blink.

How do I implement asynchronious on demand loading, when I have to support LIVE filtering/ordering (through my search method) of the entite dataset? The VirtualizingCollectionView is not an option, since it according to the documentation only supports filtering of the loaded rows.

I'm looking forward to get a sustainable fix as soon as possible :)

7 Replies

NM Nicky Mogensen March 25, 2014 03:16 PM UTC

Aaaand here is the attached file!
Attachment: DataPagerTest_de18e87e.zip


NM Nicky Mogensen March 31, 2014 09:20 AM UTC

Any updates on this matter?


PR Pradeepa R V Syncfusion Team March 31, 2014 12:08 PM UTC

Hi Nickey

 

Thank you for using Syncfusion Products and Sorry for the delay caused,

 

We have analyzed your query and we would like to let you know that, Initially empty rows will be created when you load the page. After some time when call PagedSource.Refresh (once dataloaded) Grid rows will be refreshed based on data loaded,  which looks like blinking. And the certain delay caused in loading the items is which looks like blinking.

 

Please let us know if you have any concern.

 

Regards

Pradeepa



NM Nicky Mogensen March 31, 2014 01:42 PM UTC

Hi.

The post provided below didn't give me any answers.

Did you run my attached sample, in the three different demo modes, which illustrates my problem? It doesn't sound like it...

In the first mode (Sync), the app is working almost fine. Except from when switching pages fast (Standard clicking): then it shows empty pages.
At the second and third mode (Async & AsyncFix), lines always turn blank the first time they're shown. This is broken. At the second mode, the rows never, never updates. They keep blank, until I leave the page and enters it again - it NEVER does the blink (Reload). It's only in the third demo mode (AsyncFix) where I manually triggers sfDataPager.PagedSource.Reload(), that it actually shows the data.

How do I implement asynchronious dataloading (where I loads/filters/sorts data through a Task), and then assign it the grid, without have the grid showing empty lines, blinking e.t.c? It's ALL pages there is shown as blank, unless I manually trigger .Reload() which causes the blink to happen.

Whenever I debug, I can see that the data has been loaded into the collection, before I call LoadDynamicItems. Which means that the Task is completed.... (otherwise it should have skipped the "await" - which doesn't really seem possible).




PR Pradeepa R V Syncfusion Team April 8, 2014 02:30 PM UTC

Hi Nickey,

 

Yes, we have checked your sample with three different modes and in all three modes it shows empty pages when we run the sample. We can avoid this by calling  PagedSource.Refresh after LoadDynamicItems. 

 

                     Query

              Syncfusion comments

In the first mode (Sync), the app is working almost fine. Except from when switching pages fast (Standard clicking): then it shows empty pages.

 

We have checked and it working fine, if you call PagedSource.Refresh after LoadDynamicItems.

At the second and third mode (Async & AsyncFix), lines always turn blank the first time they're shown. This is broken. At the second mode, the rows never, never updates. They keep blank, until I leave the page and enters it again - it NEVER does the blink (Reload). It's only in the third demo mode (AsyncFix) where I manually triggers sfDataPager.PagedSource.Reload(), that it actually shows the data.

 

Yes, you have to call PagedSource.Refresh method after LoadDynamicItems. Because this handler will return to our code once encounter the await in handler code and UI will be refreshed with previous data itself. Also we are not refreshing UI in LoadDynamicItems method call also. So for your case, you have to call . PagedSource.Refresh to refresh the UI.

How do I implement asynchronious dataloading (where I loads/filters/sorts data through a Task), and then assign it the grid, without have the grid showing empty lines, blinking e.t.c? It's ALL pages there is shown as blank, unless I manually trigger .Reload() which causes the blink to happen.

 

You can display BusyIndicator until data loads to the Grid. We will further look into this and update you the details in one business day.{04/09/2014}

Whenever I debug, I can see that the data has been loaded into the collection, before I call LoadDynamicItems. Which means that the Task is completed.... (otherwise it should have skipped the "await" - which doesn't really seem possible).

 

Yes, LoadDynamicItems is invoked only after await completed. But the event handler returned reached await code and the code below await executed once data is loaded. So you have to call PagedSource.Refresh to refresh the UI.

 

Please let us know if you have any concern.

 

Regards

Pradeepa



NM Nicky Mogensen April 8, 2014 03:14 PM UTC

Hi Pradeepa.

Thanks for you answer.

When loading data sync, it shouldn't be required to do a PagedSource.Refresh(). Otherwise you need to update you documentation here: http://help.syncfusion.com/UG/winrt/default.htm#!Documents/paging.htm (Scroll to bottom).

Now I get what causes this behavior. It's a mix of .NET returning from eventhandler "too early" combined with you clearing the grid. I'll just show a busyindicator then.

//Nicky


PR Pradeepa R V Syncfusion Team April 9, 2014 02:18 PM UTC

Hi Nickey,

 

we internally logged report to update the UG when using await inside OnDemandLoading event handler.We will update you regarding this once we update our documentation.

 

Please let us know if you have any concern.

 

Regards

Pradeepa 


Loader.
Live Chat Icon For mobile
Up arrow icon