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
Contributor
Posts: 26
Registered: ‎07-23-2012
My Device: bb10 dev alpha
My Carrier: movistar

SegmentedControl + dataModel

Hello

 

I want make a SegmentedControl in a ListView, and load one dataModel or other. That dataModel are in sql, no xml. It works in separated ListView and in separated qml, but in the same ListView?

 

How I can do that?

 

Thank you

Highlighted
Contributor
Posts: 26
Registered: ‎07-23-2012
My Device: bb10 dev alpha
My Carrier: movistar

Re: SegmentedControl + dataModel

Solved for myself, Im sure this is not the "best" way for do it, but it works on me.

 

I created a variable

    property variant _data

 In the SelectValueChanged of SegmentedControl

onSelectedValueChanged: {

                    if (selectedValue == 1) {
                        _data = _model01;
                        
                    }
                    if (selectedValue == 2) {
                        _data = _model02;
                        
                    }
                    if (selectedValue == 3) {
                        _data = _model03;
                        
                    }
                }

 and in the dataModel in my ListView

 dataModel: _data

 

If anyone know another way i'll be glad to know it.

 

Thank you