Limit number of pages in pagination

Limit number of pages in pagination

FlashdownFlashdown Posts: 20Questions: 3Answers: 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: 15,142Questions: 1Answers: 2,586

    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: 20Questions: 3Answers: 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.

  • GraceGuGraceGu Posts: 1Questions: 0Answers: 0

    Hi @Flashdown, I have the same concern. Did you get the solution?

  • rahulbohrarahulbohra Posts: 6Questions: 3Answers: 0

    Hi @Flashdown , @colin & @GraceGu did you find any solution?

  • FlashdownFlashdown Posts: 20Questions: 3Answers: 0

    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.

  • varnenkavarnenka Posts: 1Questions: 0Answers: 0

    @Flashdown would you send me a link for this option for limit pages of paginator?

This discussion has been closed.