Limit number of pages in pagination

Limit number of pages in pagination

FlashdownFlashdown Posts: 17Questions: 2Answers: 0

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

  • colincolin Posts: 2,734Questions: 0Answers: 479

    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

  • FlashdownFlashdown Posts: 17Questions: 2Answers: 0

    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.

Sign In or Register to comment.