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
Developer
Posts: 246
Registered: ‎01-31-2013
My Device: Developer

ListView HowTo onScrollingChanged atEnd-10

Hi,

 

Currently I'm using atEnd within ListScrollStateHandler:Smiley SurprisednScrollingChanged, to know when to read more data into my ListView,  this works but doesn't feel right as there is a brief pause while I load data.  What I am looking for is something that will allow me to trigger LoadMoreData() when I'm at atEnd-5 or atEnd-10 records before the listview end... 

 

Also, I'm not sure how to obtain the current scroll/record postion within the listview and the total scroll /record count.

 

If someone could suggest a approach it would be appreciated..

 

thanks,



GeoYeo - Free Local classifieds - Built for Blackberry 10, if you like it please Rate It and Share it!
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: ListView HowTo onScrollingChanged atEnd-10

Check out session JAM 358 from last Jam in Europe: it handled infinite lists quite well. Link

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Developer
Posts: 246
Registered: ‎01-31-2013
My Device: Developer

Re: ListView HowTo onScrollingChanged atEnd-10

Hi,

Thanks I had a.look but they are so loading mire data onEnd as I am but what I want to do is load more data several records before onEnd.

Is this possible?

Thanks


GeoYeo - Free Local classifieds - Built for Blackberry 10, if you like it please Rate It and Share it!
Retired
Posts: 252
Registered: ‎08-17-2012
My Device: BlackBerry Z10 and Q10
My Carrier: Bell

Re: ListView HowTo onScrollingChanged atEnd-10

[ Edited ]

Hi Robdob, 

 

If your item visuals are created from a ListItemComponent, then you can achieve this using the the ListItem.indexInSection and ListItem.sectionSize properties that the ListView makes availabe on the root element of the item visual

 

if(ListItem.indexInSection + 5 == ListItem.sectionSize) // or 10 if looking for the 10th item from the bottom
{
// load more data
}

 

For mor information on those properties checkout this link.

 

@SamarAbdelsayed

Did this answer your question? Please accept post as solution.
Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Developer
Posts: 246
Registered: ‎01-31-2013
My Device: Developer

Re: ListView HowTo onScrollingChanged atEnd-10

perfecto,

 

I think this is exactly what I'm looking for,  let me try it out and I'll let you know..

 

thanks,



GeoYeo - Free Local classifieds - Built for Blackberry 10, if you like it please Rate It and Share it!