I have data which consists of thousands of items that I want to be able to display. However, displaying all items at the same time would significantly weight down performance. Also, I only really need to view a few items at a time.
So basically, what I want is something that behaves like a Facebook news feed, Twitter timeline or any instant messenger chat history view. In all those examples, initially, I'm only being shown a few items and by scrolling to the end of the list, I can dynamically load more.
I can also jump to a specific position of the feed, like a certain date and time of a chat history. The feed usually doesn't load and show every single message from now until the specified history position, but it jumps to the position and shows a few surrounding messages. Again, by reaching (either) end of the list, more items are dynamically added.
What is this feature called? Which library can I use to implement it?
Here is a small proof-of-concept that doesn't require any 3rd-party libraries.
In this example, the database consist of 501 items from 0 to 500.
FeedEngineis taking care of the mechanics that add/remove items from the list. The actual site/item content is managed by anitemCallbackfunction. Here, it is calledcustomItemBuilderand is kept very simple: it only displays the item index and alternates the background color. This is where you would actually pull the contents for that specificitemIndexfrom your database and dynamically adjust theitemElementaccordingly.On mobile, you can swipe through the items. On desktop, it's best to use the mouse wheel to scroll through the feed.