mwillema
Infinite scrolling both ways (up and down)
Hi everyone,
I’m trying to implement an infinite scrolling both up and down. The use case is basically a calendar (like iCal for instance) where you can infinite scroll the following weeks, but also the previous weeks.
For scrolling the following weeks, with a proper Hook and phx-update="append", that’s fine.
However for scrolling the previous weeks, I have the following issues:
-
phx-update="append"only add the data after the existing ones. Which is fine for half of this use case. -
When loading the page, if I try to scroll up right away, no scroll event is published. I first have to scroll down a little bit first.
Any idea?
Most Liked
cblavier
The latest LiveView 0.18 release introduced streams, which is a perfect solution for this issue: stream/4 documentation
A comprehensive blog post is available here:
dtew
There might be something of interest in this blog post: A hook for handling very large lists with Phoenix Live View ⋅ Alex-min's tech blog
LostKobrakai
You could use two separate lists: One for prepending one for appending.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









