blackberry / bbUI.js

BlackBerry UI look and feel JavaScript toolkit for WebWorks
Apache License 2.0
312 stars 192 forks source link

bb.pillButtons.style() bug #949

Closed broche closed 11 years ago

broche commented 11 years ago

I have a div with a data-bb-type="pill-buttons" and statically create pill-buttons within said container. I want to save the state of which pill-button was selected when returning to the screen with them on it. So, in ondomready function, I set the 'data-bb-selected' attribute to true on whichever pill-button was previously selected, and then call bb.pillButtons.style(document.getElementById("pills"));

Unfortunately, this causes some weird issues where a new pill-button-container is added to the screen. [Shown in the picture below]

pillbuttonsbug

Is this a known issue, or am I doing something out of the ordinary here? Thanks.

tneil commented 11 years ago

You should be able to set the bb-selected on the pill button in the onscreenready. That will set the DOM before it gets styled.

tneil commented 11 years ago

Be sure to use the element.getElementById('foo') to edit your screen's HTML and not document.getElementById('foo')

broche commented 11 years ago

Awesome! That fixed it. Thanks Tim.