I was wondering what people think the best way is to jump to a specific page within a sharepoint list, taking into account performance considerations.
eg:
1) List with 1000 items in it
2) Each page contains 10 items
3) Show up to 10 pages at a time.
4) User can jump to any page by typing in the page number (i.e. No Next / Previous)
Here is my thinking
1) Using itemsPerPage = 10, pageNumber = ?
Use 2 Queries and a loop to find the ListItemCollectionPosition and Combine with RowLimit.
i.e.
a) Get the start position
ListItemCollectionPosition positionToStart = null;
for (int i = itemsPerPage ; i < itemsPerPage * pageNumber; i + itemsPerPage)
{
SPQuery.RowLimit = itemsPerPage ;
var spItems = SPList.GetItems(SPQuery).Items;
if (spItems.ListItemCollectionPosition != null)
{
positionToStart = spItems.ListItemCollectionPosition;
}
}
b) Get The Results
SPQuery.RowLimit = itemsPerPage;
SPQuery.ListItemCollectionPosition = positionToStart
return SPList.GetItems(SPQuery).Items;
Any help would be great!