DataPager loads all entities on first request

5 posts, 0 answers
  1. Michael
    Michael avatar
    6 posts
    Member since:
    Sep 2011

    Posted 03 Apr 2012 Link to this post

    Hello,

    I have a view where entities are loaded into a gridview and should be paged and filtered using DataFilter and DataPager. The code is very similar to the demo (http://demos.telerik.com/silverlight/#DomainDataSource/RadDataFilterIntegration).

    The problem is, that on the first request, all entities are loaded, although PageSize on the RadDomainDataSource and RadDataPager is set to 25. If i change to page 2, only 25 entities are loaded. The same is when I go back to page 1.

    I have monitored the traffic with Fiddler, and on the first request, there is no take parameter. On subsequent requests, there is the take-parameter and if the requested page number is greather than 1, the skip-parameter.

    I've tried to set AutoLoad on the DomainDataSource to false and trigger the Load-Method it in code-behind, but this results in the same behavior.

    I'm using version number 2011.3.1220.1040 (I have to use Silverlight 4).

    Thanks in advance,

    Michael
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 03 Apr 2012 Link to this post

    Hello,

    Most probably the first request to the server is sent before the PageSize of RadDomainDataSource have been initialized. But I cannot guess why is this happening without having something that I can run and debug.

    I have prepared a small dummy project with RadDataPager and RadDomainDataSource. Could you please modify it so it does reproduce this behavior and then send it back to us for debugging. 

    Thanks in advance.

    Greetings,
    Ross
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Michael
    Michael avatar
    6 posts
    Member since:
    Sep 2011

    Posted 04 Apr 2012 Link to this post

    Hello,

    thanks for your quick response. After having some troubles getting your sample up and running paging worked correctly. I have inserted my markup except the query and context and it also worked.  Then I inserted my model and domain service into your project and it also worked.

    Debugging in my project showed, that in the DataSource-Loading Event, LoadingDataEventArgs.Query.Query was null on the first request and on following request not null. I use Prism, so i decided to change RadDomainDataSource to QueryableDomainServiceCollectionView in my code behind. That did the trick. Paging is now working correctly, maybe Prism broke the paging.

    Thanks for your help,

    with kind regards,

    Michael
  5. Rob Conley
    Rob Conley avatar
    47 posts
    Member since:
    Sep 2012

    Posted 15 Jan 2013 Link to this post

    I had this same issue and after trying many things I noticed that the ordering of the AutoLoad property matters. Here I am creating a QDSCV and eventually assigning it to a RadTreeListView and a RadDataPager in XAML with an MVVM approach.

    When placed before the PageSize (see below), it ignored the PageSize on the first load and loaded all rows. When I placed the PageSize above the AutoLoad, I get my page size of 100 on the first load. Bug?
    public static QueryableDomainServiceCollectionView<SearchDetailMembershipIndexedByMembershipView> GetSearchDetailMembershipIndexedByMembershipViewQueryable()
    {
      var query = _context.GetSearchDetailMembershipIndexedByMembershipViewsQuery().OrderBy(m => m.Name);
     
      // create the QDSCV, using the context and the query
      var view = new QueryableDomainServiceCollectionView<SearchDetailMembershipIndexedByMembershipView>(_context, query);
     
      view.AutoLoad = true;
      view.PageSize = 100;
      
      return view;
    }
  6. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 16 Jan 2013 Link to this post

    Hi,

    The very moment you set AutoLoad to true, it will send an asynchronous load request to the server. So yes, ordering really matters. Always set AutoLoad to true after you have configured everythinhg else.

    All the best,
    Rossen Hristov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
DevCraft banner