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

Web and WebWorks Development

Reply
Developer
nathanpc
Posts: 126
Registered: ‎05-19-2012
My Carrier: VIVO Brazil
Accepted Solution

Selecting a Pill Button Item From JavaScript

I've been developing a app using the awesome bbUI.js library, in this particular app I've used a control for the first time, the Pill Button control. One of the things that I need to make on this app is set the selected item dinamically, just like I can do with the Drop Down control .setSelectedItem(), but there's nothing in the docs detailing how to make it for Pill Buttons. Any ideas?

If I helped you please click the "Like" button to support my work.
My apps: GAGmobile - CherryNotes - Requests
Social Me: about.me - Twitter
Please use plain text.
Regular Contributor
BertKoor
Posts: 81
Registered: ‎03-09-2012
My Carrier: n/a

Re: Selecting a Pill Button Item From JavaScript

Disclaimer: I haven't used a Pill Button yet.

But it looks like it's just DIV elements. DropDown works on an extended Select element.

So I think you need to lookup the div with data-bb-type="pill-buttons", iterate through its sub-divs and change all data-bb-selected attributes.

Please use plain text.
Developer
nunodonato
Posts: 313
Registered: ‎03-28-2012
My Carrier: TMN

Re: Selecting a Pill Button Item From JavaScript

If you are talking about smartphones, there isn't a way to do it... yet, but it's in the BBUI roadmap.

You can, however, change all the attributes manually... or think of a better option :smileyhappy:

Nuno
theBBthing.wordpress.com - my BlackBerry development blog: news, tips and tutorials
bitoutsidethebox.com - re-imagining digital solutions


Please use plain text.
Developer
nathanpc
Posts: 126
Registered: ‎05-19-2012
My Carrier: VIVO Brazil

Re: Selecting a Pill Button Item From JavaScript

Oh thanks very much for the information. I'll implement a Drop Down for the first version of the app then when the set method is implemented on the next versions I'll update the app to include the Pill Buttons. :smileyhappy:

If I helped you please click the "Like" button to support my work.
My apps: GAGmobile - CherryNotes - Requests
Social Me: about.me - Twitter
Please use plain text.
Developer
br14
Posts: 484
Registered: ‎06-24-2008

Re: Selecting a Pill Button Item From JavaScript

Not sure if there's an official solution for this issue, but the following worked for me...

 

var pb1 = document.getElementById('pushbutton1');

pb1.dotouchstart();

pb1.dotouchend();

 

You need both calls. I don't see any downside to this approach so far.

Please use plain text.