I have implemented paging using the xamgrid defining a pagesize of 10 and everything works fine(returning all the rows at once). I was wondering is there a way to tell the grid the total rows that can be returned from the query and only display the first page, and everytime the user clicks on a new page we hit the server to get the results or is there a different way to accomplish this. In short I dont want to wait for the query to return 100,000 or rows more I want the xamgrid to know the total, display all the pages, but retrieve the rows on dependant on the page the user selects?
I appreciate the time you took to give the answer; its an excellent solution and save me time. I will use the DomainDataSource how do you bind the xamgrid.
Hi,
There is no direct way to set TotalItemCount to the XamGrid and pass it just the items for the current page view. However, if you use DomainDataSource (DDS) the XamGrid will be able to play smart and request only the items that are needed for the page to be displayed, the DomainDataSource will do the rest. (DDS implements IPagedCollectionView, the XamGrid uses this interface to get the info for the TotalItemCount, PageSize, PageIndex).
If you, for some reason, do not want to use DDS, you can check the December release of RIA Services Toolkit (link) and DomainCollectionView - MVVM-friendly collection view for RIA services.
HTH
Yes I actually use Ria services, but I need to know how to use the paging portion of the xamgrid, meaning apply the total amount of pages to the grid but not returning all the rows and retrieving the rows needed based on the page clicked. I can implement my own version of paging and apply that to that to the xamgrid, but that not my goal. From what I see u return a total result set and the set the pagesized and the grid handles the rest. Again I want to retrieve the rows once a page i click using the xamgrid. If you have some sample code I would greatly appreciate it.
Have you considered using RIA Services for the server side paging (sorting, grouping and etc.)?
XamGrid supports RIA Services and collections that implement IPagedCollectionView.
Regards,