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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 13
Registered: ‎02-08-2013
My Device: Z10
My Carrier: Rogers
Accepted Solution

ListView end of List(Pull Up to load more)

[ Edited ]

I have Listview in which I want to add more Items when I am about to reach the end of List. Currently I am using onAtEndChanged signal to load more. But I would like to load more when I am about to reach around 80% of my list. I am also using custom datamodel for my listview. Which signal will help me to get the indexPath so that I can load more Items once specific indexPath is reached on my listview. 


I tried to implement it on C++ but I couldnt. Any help on this


QVariant listitem::data(const QVariantList& indexPath)
	int index = indexPath[0].toInt();
	return _itemList.at(index);


Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Re: ListView end of List(Pull Up to load more)

[ Edited ]

Hmm... this sounds more like "infinite scroll" like functionality you are looking for then pull up to refresh. This solution loads posts when you scroll an item into view that is 12 from the bottom of the list. You could do math based on your list size to do 80%. In any case, if you just want to load more items at the end of your list once you've scrolled through some amount of your list you can do this:


//Connect a scroll state handler. BAM!
		.onFirstVisibleItemChanged(this, SLOT(onFirstVisibleItemChanged(QVariantList)));

 then do this:

void App::onFirstVisibleItemChanged(QVariantList firstItem)
	int listIndex = this->m_RedditPostsModel->indexOf(this->m_RedditPostsModel->data(m_CurrentFirstVisibleListItem), 0);
	qDebug() << listIndex;

//load more posts when we are 12 posts from the bottom of the list. int threshold = m_CountOfPostsRetrieved - 12; if(listIndex > threshold) { //simulate pressing the load more button. callAFunctionToLoadMoreItems(); } }

 sorry if there are any errors in this code. This is the code I use but I simplified it a bit since I only use infinite scroll in some cases. This solution would always use infinite scroll.

Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Posts: 13
Registered: ‎02-08-2013
My Device: Z10
My Carrier: Rogers

Re: ListView end of List(Pull Up to load more)

Great. onFirstVisibleItemChanged signal did the magic. It works fine now. Thank you very much. Smiley Happy
Posts: 237
Registered: ‎11-24-2012
My Device: Blackberry 10 Dev Alpha
My Carrier: Telkomsel

Re: ListView end of List(Pull Up to load more)

Hi, I'm trying make load more like from this sample code, but fail.

Maybe I'm wrong implement the sample.


What is m_CurrentFirstVisibleListItem here, how to get the value?