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

DataPager.PagedSource.ResetCache performance

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

2 Replies

LS Luca Spolidoro August 1, 2017 08:56 PM UTC

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);
            }

        }



GT Gnanasownthari Thirugnanam Syncfusion Team August 2, 2017 02:44 PM UTC

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. 
 
 
 


Loader.
Live Chat Icon For mobile
Up arrow icon