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.

DataPager.PagedSource.ResetCache performance

Thread ID:

Created:

Updated:

Platform:

Replies:

131888 Aug 1,2017 03:30 PM Aug 2,2017 10:44 AM WPF 2
loading
Tags: SfDataGrid
Luca Spolidoro
Asked On August 1, 2017 03:30 PM

I'm using a pager with sorting, and, as suggested by this page: https://help.syncfusion.com/wpf/sfdatagrid/paging#sorting-complete-collection
I'm resetting the cache for the DataPager.

The problem is that I have a pretty big table of data, and just resetting the cache takes more that 6 seconds:


can you provide an async version of those function or make them perform better?

thanks,
Luca

Luca Spolidoro
Replied On August 1, 2017 04:56 PM

By looking at the IntelliTrace, it looks like the API is doing lots of ADO.NET calls (I wasn't expecting any, since this is just a cache clear).

I'm using Entity Framework and an IQueryable for binding ItemSource, here the full code:

      private MainViewModel vm => (MainViewModel)DataContext;
      private string _lastSortedColumn = "DateLastSaved";
      private ListSortDirection _lastSortDirection = ListSortDirection.Descending;

      private void DataPager_OnOnDemandLoading(object sender, OnDemandLoadingEventArgs args)
        {
            var pageData = _lastSortDirection == ListSortDirection.Ascending ?
                vm.Presentations.OrderBy(_lastSortedColumn) :
                vm.Presentations.OrderByDescending(_lastSortedColumn);

            DataPager.LoadDynamicItems(args.StartIndex,
                pageData.Skip(args.StartIndex).Take(args.PageSize));
        }

        private void PptDataGrid_OnSortColumnsChanging(object sender, GridSortColumnsChangingEventArgs e)
        {
            DataPager.PagedSource.ResetCache();
            DataPager.PagedSource.ResetCacheForPage(DataPager.PageIndex);

            if (e.Action == NotifyCollectionChangedAction.Add || e.Action == NotifyCollectionChangedAction.Replace)
            {
                var sortDesc = e.AddedItems[0];
                _lastSortedColumn = sortDesc.ColumnName;
                _lastSortDirection = sortDesc.SortDirection;

                DataPager.MoveToPage(DataPager.PageIndex);
            }

        }


Gnanasownthari Thirugnanam [Syncfusion]
Replied On August 2, 2017 10:44 AM

Hi Luca, 
 
We have analyzed your query and we are unable to reproduce the reported issue with your given details, We have tried to reproduce the issue by below steps. 
 
1.     Navigate all the pages in SfDataPager. 
2.     Try to sort the column. 
3.     In SortColumnChanging event we have cleared the cache. 
4.     While clear the cache it takes 35 ms. 
5.     In our application we have loaded 7000000 records. 
6.     We have checked in Syncfusion product version 14.4.0.15 and 15.2.0.46. 
 
Kindly provide us your assembly version details which you are using to reproduce the issue along with the Syncfusion.SfGrid.WPF.dll assembly and sample application or complete code snippet to illustrate the workflow for reproducing this issue from our end, thereby we will analyze further and update you with the appropriate solution as much as earlier.  
 
Regards, 
Gnanasownthari T. 
 
 
 


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.

;