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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Cascades Development

Reply
Contributor
SnGupta
Posts: 11
Registered: ‎01-24-2013
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.?

 

Please use plain text.
Developer
Curahee
Posts: 122
Registered: ‎01-12-2013
My Carrier: -

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.

______________________________________________________
Voetbal afgelast in België? Check at AppWorld
Please use plain text.
Developer
zezke
Posts: 831
Registered: ‎12-12-2010
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.

-------------------------------------------
Your like is much appreciated!
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Please use plain text.
Contributor
SnGupta
Posts: 11
Registered: ‎01-24-2013
My Carrier: Airtel

Re: ListView row binding with ListView

how can i set images, comming from server and lever also on a particualr position?
Please use plain text.
Contributor
SnGupta
Posts: 11
Registered: ‎01-24-2013
My Carrier: Airtel

Re: ListView row binding with ListView

There is issue for handling server response, No issue for handling for local data
Please use plain text.
Contributor
SnGupta
Posts: 11
Registered: ‎01-24-2013
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??
Please use plain text.
Developer
Curahee
Posts: 122
Registered: ‎01-12-2013
My Carrier: -

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.

______________________________________________________
Voetbal afgelast in België? Check at AppWorld
Please use plain text.