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
Contributor
Posts: 11
Registered: ‎01-24-2013
My Device: BB10
My Carrier: Airtel

ListView row binding with ListView

Hi All,

 

I am curious to know about how to bind custom row with ListView and set row property(such as Level, ImageView,) dynamically with QML.?

 

Developer
Posts: 230
Registered: ‎01-12-2013
My Device: z30
My Carrier: Mobile Vikings

Re: ListView row binding with ListView

I'm not sure what you mean. Do you mean you want to customize your listitem? Here is an example of QML code where I use an ImageView and stuff to customize everything.

 

ListView {
    id: myList
    leftPadding: 10
    rightPadding: 10
    dataModel: GroupDataModel { }

    listItemComponents: [
        ListItemComponent {
            type: "item"
            
            Container {
                id: itemRoot
                layout: DockLayout { }
                
                Container {
                    topPadding: 20
                    bottomPadding: 20
                    leftPadding: 5
                    layout: StackLayout {
                        orientation: LayoutOrientation.LeftToRight
                    }
     
                    Container {
                        topPadding: 15
                        
                        ImageView {
                            imageSource: "asset:///images/myImage.png"
                        }
                    }
     
                    Container {
                        leftPadding: 15
                        layout: StackLayout { }
                        
                        Label { 
                            text: ListItemData.title
                            textStyle.fontSize: FontSize.Large
                            textStyle.lineHeight: 0.8
                            textStyle.color: Color.Black
                        }
                        
                        Label {
                            text: ListItemData.subtitle
                            textStyle.fontSize: FontSize.Small
                            textStyle.color: Color.Gray
                        }
                    }
                }
                
                Container {
                    layout: DockLayout {}
                    verticalAlignment: VerticalAlignment.Bottom
                    horizontalAlignment: HorizontalAlignment.Center
                    preferredHeight: 2
                    preferredWidth: 800
                    background: Color.Black   
                }
            }
        }
    ]
}

 If you meant something else, I'm happy to help if possible.

______________________________________________________
BB10-OAuth: GitHub
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: ListView row binding with ListView

[ Edited ]

I'm not sure if I get what you're after, but I think taking a look at the ListItemComponent might help you.

 

@Curahee Well played sir.

-------------------------------------------
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!
Highlighted
Contributor
Posts: 11
Registered: ‎01-24-2013
My Device: BB10
My Carrier: Airtel

Re: ListView row binding with ListView

how can i set images, comming from server and lever also on a particualr position?
Contributor
Posts: 11
Registered: ‎01-24-2013
My Device: BB10
My Carrier: Airtel

Re: ListView row binding with ListView

There is issue for handling server response, No issue for handling for local data
Contributor
Posts: 11
Registered: ‎01-24-2013
My Device: BB10
My Carrier: Airtel

Re: ListView row binding with ListView

how can i find particular index id of ListView position

Label {
text: ListItemData.title
textStyle.fontSize: FontSize.Large
textStyle.lineHeight: 0.8
textStyle.color: Color.Black
}

how would i know which on is Title, which one is sub-title and which one is Status??
Developer
Posts: 230
Registered: ‎01-12-2013
My Device: z30
My Carrier: Mobile Vikings

Re: ListView row binding with ListView

I add an own written QObject to the the groupdatamodel. The title and subtitle are just properties of that QObject. So if my property was called firstname, then the code would be ListItemData.firstname.

 

About the index of the listview position, I'm not sure about that. Tried a couple of things here but no succes yet. If I find something, I'll keep you posted.

______________________________________________________
BB10-OAuth: GitHub