Closed espen closed 5 years ago
Someone posted a link at the very beginning of the Pagy life about the subject. It sounds interesting but I didn't have the time to really think about it yet. I will add some comment ASAP. Thanks for the interest.
it looks like implementing the keyset pagination in Pagy boils down to change just one line of code: https://github.com/ddnexus/pagy/blob/538cf4a5c6e4a031bbd7dab1dfebcd0d591a1ec3/lib/pagy/backend.rb#L28
That could be easy implemented as a backend extra with probably one single method override in it.
If you want to get a shot at it, you will have all my support, because having a keyset
extra would be very cool!
I guess what is needed is an attribute for which column to use as a key to order. With an input for last seen value to be used when querying the next page. That sounds simple enough but looking at the order_query source I'm not so sure. I will try it out and see if it can be handled directly in pagy or whether it must be more versatile and relay it to order_query as an extra in pagy.
Thanks!
see #136
Long time since this one.
The Pagy::Keyset pagination arrived in all its glory in v9.
Yeah... long time... I know 😁
Have you considered keyset pagination? It would result in much better database performance.
I see there is order_query but I haven't tried it. Looking briefly at the code it would definitively complicate things. Perhaps it could be used as a plugin?
What are your thoughts on this?