Reputation: 4868
I'm using the latest nativescript (3.1.1) and RadListView. I'm trying to achieve infinite scrolling when the user scrolls up the list (similar to how Facebook Messenger, Whatsapp and other chat apps work).
I know loadOnDemand
works great but it works only when the user scrolls down. Is there a way to make loadOnDemand
work when the user scrolls up? Or any other workaround?
Many thanks!
Upvotes: 1
Views: 1269
Reputation: 2901
The current version of RadListView does not provide such "load on demand in upwards direction" feature, it does provide "pull to refresh" and "load on demand from bottom".
You can achieve this with some custom implementation using the scrolling events of the RadListView
as explained in the discourse.nativescript.org thread here. I will post the answer's text here also for better visibility to the community:
Actually I think you might easily achieve this using the scrolling events exposed by RadListView: http://docs.telerik.com/devtools/nativescript-ui/Controls/NativeScript/ListView/scrolling
You can use the scrolled in particular: http://docs.telerik.com/devtools/nativescript-ui/api/classes/radlistview.html#scrolledevent
This event exposes the current scroll offset of the list. Once it becomes 0 or negative you can start a data-fetch process, raise a flag that a process is undergoing and reset it once the data has arrived.
Upvotes: 1