Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Trusted Contributor
AllSystemGo
Posts: 140
Registered: ‎11-23-2010
My Device: Torch 9800
My Carrier: Rogers
Accepted Solution

Listview question

[ Edited ]

I have a question about listview.

 

I'm downloading from a website a rss feed that has multiple page in a listview, but I can only download one page at a time, so I was wondering if it was possible for the listview to detect that I get to the end of the list, which is 15 long, then preload the second page online. And that as smoothly as possible.

 

Thank you for the help.

 

UPDATE:

 

I just saw that there was a ScrollPosition that I could read : https://developer.blackberry.com/cascades/reference/bb__cascades__scrollposition.html

 

but i'm wondering about how to make the transition between the guy ending the first page and loading the second one, then the third ect... in the listview

Please use plain text.
Developer
strobejb
Posts: 267
Registered: ‎10-15-2012
My Device: bb10 developer
My Carrier: Orange

Re: Listview question

You've got a couple of options

 

ListScrollStateHandler gives you the atEnd property 

 

https://developer.blackberry.com/cascades/reference/bb__cascades__listscrollstatehandler.html#atend

 

If that isn't sufficient, then you can write your own custom datamodel. The data() function is called with the indexPath of the item that the ListView wants to access. In your datamodel you can check to see if this indexPath represents the position in the list that you want to start loading extra data

 

Please use plain text.
Trusted Contributor
AllSystemGo
Posts: 140
Registered: ‎11-23-2010
My Device: Torch 9800
My Carrier: Rogers

Re: Listview question

Thank you for your answer. What I was wondering is how do I make it so when the user gets to the bottom of the list I load in the second part of the json file and the transition is made smoothly. Might be easier to have a button for the next page I don't know.
Please use plain text.
Developer
strobejb
Posts: 267
Registered: ‎10-15-2012
My Device: bb10 developer
My Carrier: Orange

Re: Listview question

The solution is in my first reply

1. Use a ListScrollStateHandler and connect to the atEnd signal. When the signal is received the user is at the end of the list - so load your json

2. Use the custom datamodel approach. When the listview calls your DataModel::data() function with an indexPath that represents the end of the list, you know that the user has scrolled to the bottom - so load your extra data if this is true
Please use plain text.