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

Web and WebWorks Development

Reply
Highlighted
Developer
Posts: 123
Registered: ‎02-13-2012
My Device: Z10 LE
My Carrier: Mobistar

Keeping a page loaded in the background in BBui.js

I have a page running in BBui, the user can make changes to it like interacting with inputs and adding more inputs (using javascript), then I want to push a settings page over the first one, but when I pop that settings page again I want the original page like it looked before. Is there a way to keep the original page loaded when pushing the settings page in stead of unloadng it and reloading it when the settings apge is popped?

Please click the like button if my post helped you! Thank you.
Developer
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: Keeping a page loaded in the background in BBui.js

I just did this and the answer is simply to cheat and switch divs Smiley Happy

 

This is, it must be stressed, not how BBui is designed to be used

 

The downside is that settings are only available from the page with the 2 divs




Click the like button if you find my posts useful!
Developer
Posts: 123
Registered: ‎02-13-2012
My Device: Z10 LE
My Carrier: Mobistar

Re: Keeping a page loaded in the background in BBui.js

The settings only being available from that page isn't a big problem, but wouldn't 2 divs with separate screens mess up BBui? The settings needs a different navigation bar etc.
Please click the like button if my post helped you! Thank you.
Developer
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: Keeping a page loaded in the background in BBui.js

Ahh - that's a bit different (having an actionbar for the settings)

 

In mine the system menu includes a Settings page button which I use to switch divs leaving the Action Bar as-is

 

This is the basic layout of a BBui page with an action bar

 

<div data-bb-type="screen" data-bb-effect="slide-left">
        
        <!-- Start of page content -->


        <!-- End of page content -->


        <div data-bb-type="action-bar">
                <div data-bb-type="action" data-bb-style="tab" data-bb-overflow="true" data-bb-accent-text="Accent Text" data-bb-img="images/actionBar/cog_dark_theme.png" onclick="showTab('tabOverflow');">Tab 1</div>
                <div data-bb-type="action" data-bb-style="tab" data-bb-overflow="true" data-bb-img="images/actionBar/cog_dark_theme.png" onclick="showTab('tabOverflow');">Tab 2</div>
        </div>
</div>

 

Your content area (marked above) can be wrapped in a named div - no problem there

 

You can extend this to have additional content areas each with their own named divs all of which are display: none

 

To change the content you can simply set display: block for only the content div you wanna show in JS

 

Tim uses this idea in the activityBar demo in the BBui.js demo package

 

I can think of a hacky way to do it with action bars for both - basically define all action buttons required but then hide the irrelevant ones. With only two pages that's not too messy

 




Click the like button if you find my posts useful!
Developer
Posts: 123
Registered: ‎02-13-2012
My Device: Z10 LE
My Carrier: Mobistar

Re: Keeping a page loaded in the background in BBui.js

I currently use the div switching method to switch between different tabs, no problem there.
I'll try your idea for the action bar, let's hope it works for switching between a tabbed action bar and one with a back button...
I wonder what would happen if I define multiple screen divs in one html page and hide/show the settings screen using javascript...
Please click the like button if my post helped you! Thank you.