If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
bmorr
Posts: 304
Registered: ‎04-13-2013
My Device: Z10
My Carrier: Telus

Possible to use drop down menu to choose between different listviews?

Hello all,

 

I was wondering if it is possible to have a drop down menu on a page with various different selections, and when clicked it would show a specific listview for that selection.  I want to have different listviews show up depending on what category the user chooses in the drop down menu.  I've searched on here and on the developer forums, but I can't seem to get any info on this, that or maybe I'm using the wrong search terms :smileyfrustrated:

 

Thanks in advance!

Please use plain text.
Developer
simon_hain
Posts: 15,908
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Possible to use drop down menu to choose between different listviews?

sure, that should be possible.
you could exchange the datamodel and use a single listview, for example.

what exactly is your issue?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
bmorr
Posts: 304
Registered: ‎04-13-2013
My Device: Z10
My Carrier: Telus

Re: Possible to use drop down menu to choose between different listviews?

The main issue is that I don't know what to put after doing:

DropDown{

Option{}

}

I tried to tie the option value to the list view I wanted to show. I'm just not sure how to pass the information between the two. If I can just use a single list view that would be much simpler, would I have to do if else statement depending on the drop down selected?

Thanks!
Please use plain text.
Developer
simon_hain
Posts: 15,908
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Possible to use drop down menu to choose between different listviews?

connect to https://developer.blackberry.com/native/reference/cascades/bb__cascades__dropdown.html#function-sele...
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
bmorr
Posts: 304
Registered: ‎04-13-2013
My Device: Z10
My Carrier: Telus

Re: Possible to use drop down menu to choose between different listviews?

I just want to have a drop down to select different categories so that a list showing only items with a certain category attribute are shown, if that helps you understand a bit more what I'm trying to get at.
Please use plain text.
Developer
BBSJdev
Posts: 6,036
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
My Carrier: Orange

Re: Possible to use drop down menu to choose between different listviews?

It sounds like you want to filter the ListView, if I understand your example there are several ways of achieving this;

 

1) Have a configurable ListView using ComponantDefinition

2) Create your own ListView with a custom datamodel

3) Create Multiple ListViews that hide/show depending on the dropdown (worst option)

 

The complexity obviously determines which of option 1 or 2 works best for you.

 

Your dropbox would then set the filter property within the ListView.

 


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.
Please use plain text.
Developer
bmorr
Posts: 304
Registered: ‎04-13-2013
My Device: Z10
My Carrier: Telus

Re: Possible to use drop down menu to choose between different listviews?

[ Edited ]

I think you're right!  Totally forgot about using filters.  Thanks.  Will let you know if it works for me and click accept solution if it does.

Please use plain text.
Developer
bmorr
Posts: 304
Registered: ‎04-13-2013
My Device: Z10
My Carrier: Telus

Re: Possible to use drop down menu to choose between different listviews?

BBSJdev:  Is it possible to implement the filter within QML?  or do I have to do a whole process of manually implementing the parameters in C++?  I'm using persisentobjects data model and the categories are pre-defined but saved as a child, NOT a header.

 

If it does require implementation within C++ do I include it as it's on Q_invokable function or just add the code to the existing datamodel?

 

I'm sorry if these questions may not make sense,  I only have basic experience coding and I've been building this application and I'm basically done, just thought it would look nice if I could filter the items based on category, but if it's too difficult I will just save this feature for my next update.

 

thanks in advance.

 

regards,

Please use plain text.