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
Posts: 88
Registered: ‎01-05-2013
My Device: BB10
My Carrier: Viettel

Change ListItem Property

I have a simple ListView

ListView {
            id: mListView
            dataModel: arrDM

            listItemComponents: [
                ListItemComponent {

                    Container {
                        preferredWidth: maxWidth

                        preferredHeight: 100
                        id: rootContainer
                        Label {
                            text: ListItemData
                        }
                        

                    }
                }
            ]
}

 And I want to write ListItemSelect(indexPath) function along the ListView that can set opacity of "rootContainer" at the indexpath to 0.5. But I cant access to rootContainer at the right indexPath.

 

Any way to get rootContainer at the indexPath of a ListView

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Change ListItem Property

Hi,
The correct way to do this is modifying the entries in dataModel and binding to them in ListItemComponents. This way the changes will be correctly reapplied when ListView reuses ListItemComponents during scrolling.

Andrey Fidrya, @zmeyc on twitter
Highlighted
Developer
Posts: 88
Registered: ‎01-05-2013
My Device: BB10
My Carrier: Viettel

Re: Change ListItem Property

I dont know how you can change the Container's opacoty throught dataModel?. Can you give some code?