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
Highlighted
Developer
Posts: 149
Registered: ‎04-23-2011
My Device: BlackBerry 9700 Bold
My Carrier: Turkcell

How to Access the Data in the ListView...

Hi,

 

I have the following listview and I'd like to get the category title. Only one item is displayed on the screen, and the item changes when scrolling right or left. How can I access the category title?

 

 

Container {
            
            Container {
                leftPadding: 20
                ListView {
                    id: categoriesList
                    
                    dataModel: XmlDataModel {
                        source: "models/categories.xml"
                    }
                    
                    horizontalAlignment: HorizontalAlignment.Fill
                    
                    listItemComponents: [
                        ListItemComponent {
                            type: "category"
                            id: root
                            Container {                          
                                layout: StackLayout {
                                    orientation: LayoutOrientation.LeftToRight
                                }
                                
                                preferredWidth: 675
                                minWidth: 675
                                
                                Container {
                                    
                                    Container {
                                        
                                        layout: StackLayout {
                                            orientation: LayoutOrientation.LeftToRight                                            
                                        }
                                        topPadding: 20
                                        bottomPadding: 30            
                                                                              
                                        ImageView {
                                            id: categoryImage
                                            imageSource: ListItemData.imageFile
                                        }
                                        
                                        Label {
                                            id: categoryName
                                            text: ListItemData.title
                                            textStyle.fontSize: FontSize.Large                                          
                                        }
                                    }
                                    

 

Retired
Posts: 571
Registered: ‎06-25-2010
My Device: Z10
My Carrier: Vodafone

Re: How to Access the Data in the ListView...

Can you post a complete qml file plus your xml or some subset of it so I can investigate please? Thanks.

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim