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: 39
Registered: ‎03-09-2014
My Device: Simulator
My Carrier: NA
Accepted Solution

DropDown and Listview

[ Edited ]

Hi guys,

 

I have a DropDown menu and a ListView in a page. I want to expose DropDown value in the ListView, so the content of the ListView will be dynamically appeared depends on user choice in DropDown menu. The problem is DropDown value doesn't appear in the ListView, why is this happening, and is there any other way to do it? Here is my code.

 

 

DropDown {
  id: set
  title: "Select"
  Option {
     id:dropdown
     value: "Value A"
     text: "Value A"
 }


ListItemComponent {
    type: "item"
    StandardListItem {
       imageSpaceReserved: false
          title: "	" + ListItemData.data1
          status: set.selectedValue + " " +ListItemData.data2
    }
}

 

Any help would be appreciated. Thank you.

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: DropDown and Listview

ListItems are not in the same scope as the rest of the QML file you can get round this by calling a function or using signals and slots.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: DropDown and Listview

Take a look at this for an example of how to call a function outside the ListView...

 

http://supportforums.blackberry.com/t5/Native-Development/listItemComponent-invoking-functions-issue...


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 39
Registered: ‎03-09-2014
My Device: Simulator
My Carrier: NA

Re: DropDown and Listview

Hi BBSJdev, it worked perfectly. I've successfully made the function and call it in the ListView, i've never seen this method before. Thank you.

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: DropDown and Listview

You're welcome, best of luck with your app.

If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.