Skip to content
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

Open
obsidienne opened this issue May 9, 2023 · 5 comments
Open

Infinite scroll pagination #192

obsidienne opened this issue May 9, 2023 · 5 comments

Comments

@obsidienne
Copy link
Contributor

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 ?

@woylie
Copy link
Owner

woylie commented May 10, 2023

I didn't implement this yet, but a PR is welcome! Should be based on LiveView streams now.

@obsidienne
Copy link
Contributor Author

obsidienne commented May 12, 2023

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?

@woylie
Copy link
Owner

woylie commented May 15, 2023

Yes, maybe better.

@Thr3x
Copy link

Thr3x commented Jul 3, 2024

Any update on this? It would be really nice

@woylie
Copy link
Owner

woylie commented Jul 3, 2024

LiveView has phx-viewport-top and phx-viewport-bottom attributes now. There's an example for infinite scroll in the documentation. All you need to do on the Flop side is to set the pagination type to :first or :last and call Flop.to_next_cursor/1 or Flop.to_previous_cursor/1 in your event handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants