Limit number of pages in pagination
Limit number of pages in pagination
Is it possible to set the max number of pages displayed in the pagination? It is needed for the case when the actual number of pages is too huge and requesting data for last pages may impact server performance (MySQL is known to be pretty slow when it comes to pagination with big offsets, and, for instance, Elasticsearch will throw an error when requesting data with offset > 10000). So it would be great to have the ability to show the real number of records (Showing 1 to 100 of 97,859 entries
) but show only first N pages in the pagination control.
Answers
Hi @Flashdown ,
With the
serverSide
, the client just displays what the server sends back. So while there's no mechanism on the client to change/limit the number of pages, you could put that logic into the server scripts and just respond with the upper limits to what you want to allow.Cheers,
Colin
Hi @colin ,
It would be a little confusing for users if they click different page numbers but see the same data. So it does not seem to be something that can be hacked only on the server side. My goal is to display the real number of total results but limit the number of pages that a user can navigate to.
Hi @Flashdown, I have the same concern. Did you get the solution?
Hi @Flashdown , @colin & @GraceGu did you find any solution?
I just ended up with changing the paginator appearance so that it includes only first N pages (without ... and last page) so it's unlikely that a user will go too far with the "Next" button.
@Flashdown would you send me a link for this option for limit pages of paginator?