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


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.


Reply
Developer
Posts: 102
Registered: ‎06-03-2012
My Device: Playbook
My Carrier: *

Top and bottom element in ListView

Hi,

 

is there a way to add one element at the very beginning of a list and one element at the very end? In QtQuick the ListView has a header and footer property. Something like this I'm looking for.

 

Thanks,

Conny

 

-----------
http://kodira.de
BB Apps: Pattern :: Plonk
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Top and bottom element in ListView

I'm not sure if there's a better way, but since (unlike with the QtQuick one?) you can specify arbitrary types for the individual items in your list model, you should be able to create the same effect by inserting, for example, a "header" and "footer" type item in the list at the start and end. Yes, it requires you to manage their position, but maybe that's okay in your case.

I've held off really digging deep into the list stuff yet so I don't know if there's a more direct solution.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 102
Registered: ‎06-03-2012
My Device: Playbook
My Carrier: *

Re: Top and bottom element in ListView

Thanks Peter, that sounds like a possible solution. As I'm having my own C++ list model it should be possible to insert 2 fake elements with fixed positions. I'll give it a try.

 

Or maybe I can detect if the list is on the very top or very bottom and then insert elements into the UI?! My use case is something like "load next 20 items".

 

Well, I'll dig a bit deeper. If I find something useful, I'll report back here.

 

-----------
http://kodira.de
BB Apps: Pattern :: Plonk
Highlighted
Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: Top and bottom element in ListView

ListView has a leading visual property which you can add a c++/qml control to which is always there. there is nothing specifically there to keep something at the bottom of course you could write a simple method to always insert before length-1

Like all of my posts
Regular Contributor
Posts: 51
Registered: ‎04-24-2013
My Device: Z10
My Carrier: Telkomsel

Re: Top and bottom element in ListView

could u show sample code, because i want to add like a button at the bottom of list view, but not the menu context.

Thanks

Regular Contributor
Posts: 51
Registered: ‎08-07-2013
My Device: blackberry z10
My Carrier: asif

Re: Top and bottom element in ListView

 listItemComponents: [

                    ListItemComponent {

                        type: "header"

                        Container {

                            preferredWidth: 768

                            Label {

                                text: "Name:"

                                textStyle.color: Color.create("#018bb0")

                                translationX: 20

                            } 

                            Label {

                                text: "Email:"

                                textStyle.color: Color.create("#018bb0")

                                translationX: 20

                                translationY: -20

                            } 

                            Label {

                                text: "Mobile:"

                                textStyle.color: Color.create("#018bb0")

                                translationX: 20

                                translationY: -40

                            } 

                        }

                    },

                    ListItemComponent {

                        type: "item"

                        AddTo_cart { 

                        }

                    }

you can add header on page