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
madkristoff
Posts: 58
Registered: ‎11-30-2012
My Device: BlackBerry Z10

How can I show a button at the end of a listview?

I know there is leadingVisual and I am already using it, but I need a button at the end of my list and there doesn't seem to be a trailingVisual component. I have heard about infinite scrolling but that isn't what I want. I do need this button however to load more items into the list when pressed. Anyway to implement this in JUST cascades?

__________________________________________________________

If my post helped, click the like button!

Developer of Reader|YC , an open source Hackernews client
Developer
kylefowler
Posts: 526
Registered: ‎05-17-2009
My Device: 9900

Re: How can I show a button at the end of a listview?

There are a few options for doing this, theres this http://blackberry.github.io/Cascades-Samples/pageddatamodel.html

 

then you could also listen in a listscrollstatehandler for the onEnd signal, and then when thats hit, flip the visiblity on the button that makes it show up at the bottom outside the list view.

Like all of my posts
Developer
Zmey
Posts: 1,515
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: How can I show a button at the end of a listview?

Hi,
As a workaround you could return a different itemType for last indexPath (for example 'loadMore') and create a ListItemComponent for this item type with embedded "Load more" button.

You'll need to add an extra item to dataModel for this to work (in custom data model just return actual item count + 1).

Andrey Fidrya, @zmeyc on twitter
Developer
madkristoff
Posts: 58
Registered: ‎11-30-2012
My Device: BlackBerry Z10

Re: How can I show a button at the end of a listview?

Hey thanks guys! I was considering having two item types, but I wasn't sure how to make so only the last index used it.
__________________________________________________________

If my post helped, click the like button!

Developer of Reader|YC , an open source Hackernews client
Developer
ekke
Posts: 1,571
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: How can I show a button at the end of a listview?


madkristoff wrote:
Hey thanks guys! I was considering having two item types, but I wasn't sure how to make so only the last index used it.

in a GroupedDataModel you can give the item the highest possible value - then it's always the last one

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Developer
madkristoff
Posts: 58
Registered: ‎11-30-2012
My Device: BlackBerry Z10

Re: How can I show a button at the end of a listview?

Give what the highest possible value? Is there any sample apps that do something like this? (Other than the pagemodel one already posted)?
__________________________________________________________

If my post helped, click the like button!

Developer of Reader|YC , an open source Hackernews client
Developer
ekke
Posts: 1,571
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: How can I show a button at the end of a listview?

if you have a GroupedDataModel and your sorting key is an int then add your special button-Item with this attribute set to gighest value possible or if your sorting key is City set the City to 'Zzzzzzzzz' or so

 

then this item will be the last one

 

and you can ask your Headeritem if 'Zzzzzzzz' and don#t display the header

 

only some ideas you can play with

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Developer
madkristoff
Posts: 58
Registered: ‎11-30-2012
My Device: BlackBerry Z10

Re: How can I show a button at the end of a listview?

Alright thanks for the clarification. I actually think I have a solution, I'm just going to append an button item to the end of the list and then delete it when pressed, then reappend it to the end. Your idea is also good and may be faster so I'll try that if this doesn't work out.
__________________________________________________________

If my post helped, click the like button!

Developer of Reader|YC , an open source Hackernews client