-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite scroll pagination #192
Comments
I didn't implement this yet, but a PR is welcome! Should be based on LiveView streams now. |
Hi, yes LiveView streams and the new phx-viewport-top & phx-viewport-bottom https://youtu.be/FADQAnq0RpA?t=2373 and https://github.com/phoenixframework/phoenix_live_view/pull/2624/files May be wait for it to ship? |
Yes, maybe better. |
Any update on this? It would be really nice |
LiveView has |
Hi @Thr3x how you handled it ? |
@romarickb Yeah I followed @woylie advice using cursor pagination in combination with an anchor. In my app.js i created a hook for the anchor:
And in the liveview I added the hook and the anchor below my table:
This then pushes the event to the server and can be handled below:
Remember to modify your Flop Schema to use pagination. This was my setup. It only loads the first 25 entries, if the anchor is visible, it loads the next 25.
This should be everything to get you on the right track. I don't think I missed anything |
Awesome ! Thanks I was doing exactly the same kind of thing as you I misunderstood Woylie advice as I thought it was possible to to it using phx-viewport-top and phx-viewport-bottom as the example provided. Thank you for your very fast answer 😄 By the way your post is very clear and well explained ! |
Is your feature request related to a problem? Please describe.
To adapt the pagination to my use case, I need to create a custom component adding an infinite scroll behavior (something with Intersection Observer API probably)
Describe the solution you'd like
Create a custom component like cursor_pagination but based on intersection observer.
Describe alternatives you've considered
Do it myself
Additional context
Are you interested by a PR or have you already find a solution with the actual capacity ?
The text was updated successfully, but these errors were encountered: