How to handle large SharePoint list (20000) by implementing server side pagination, sorting?
How to handle large SharePoint list (20000) by implementing server side pagination, sorting?
Hi,
Jquery datatables work well for SharePoint lists which are say 200-500 records. But for records which are in thousands (say 20,000), fetching all the data at a go would not be the ideal approach. Therefore looking for server side pagination, sorting ordering and search examples and approaches that have been implemented on SharePoint lists? Currently, i am using SharePoint 2013 which provides extensive Rest API support. Can this be done? If yes, please let me know the approach?
Regards,
Rahul
This question has accepted answers - jump to:
Answers
can sharepoint output a formatted JSON response after a restful call from ajax?
by formatted I mean creating your own variables required by datatables:
Draw - int variable counter
recordsTotal int
recordsFiltered int
data - array of data source objects
see manual here at the returned data section
https://www.datatables.net/manual/server-side
Thanks for your reply. I am able to generate a formatted response from SharePoint now. I am even able to show the records in the Browser. But every time i click on sorting, paging, it reiterates the entire sharepoint list/table on the server side which is time consuming. Is it possible to modify the query written on the server side to iterate only the top 10/20 records (retaining the paging and sorting functionality) and quickly send the data back to the browser. If there is an example please share.
the next step would be to use the start and length sent parameters as query criteria to your sharepoint list
like for instance a database table with 1million rows a select * from table would take a while
but a select* from table where rownumber between 1 and 10 would run quickly
you have to use your start and length to determine that range and apply it to your list like a query criteria, does that make sense?
Got it. have implemented that part. Thanks a ton.
Can i also post custom parameters as query string to server side? If yes, can you share an instance.
Regards,
Rahul