This is a migrated thread and some comments may be shown as answers.

DataPager loads all entities on first request

4 Answers 37 Views
DataPager
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 03 Apr 2012, 03:39 PM
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

4 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 03 Apr 2012, 03:45 PM
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 >>
0
Michael
Top achievements
Rank 1
answered on 04 Apr 2012, 08:00 AM
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
0
Rob Conley
Top achievements
Rank 1
answered on 15 Jan 2013, 05:33 PM
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;
}
0
Rossen Hristov
Telerik team
answered on 16 Jan 2013, 08:16 AM
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.

Tags
DataPager
Asked by
Michael
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Michael
Top achievements
Rank 1
Rob Conley
Top achievements
Rank 1
Share this question
or