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
Regular Contributor
Asmooh
Posts: 77
Registered: ‎10-27-2010
My Device: Passport SQW100-1
Accepted Solution

Do i really need to copy menu/actionbar to every file?

Hello,

 

I know it's html5 but do i really need to copy my actionbar and my loading indicator to every page?

Or is there a way to include that piece of html code somewhere so it will always load.

 

I tried in my first file but that did not work.

 

Developer
anphorea
Posts: 134
Registered: ‎11-27-2012
My Device: Z10 LE,Dev Alpha C

Re: Do i really need to copy menu/actionbar to every file?

try make some page as a template,
and fill the data via bbui/ondomready or onscreenready events.

then you can just set the action bar div , the menu div, the loading indicator in the template.
/*
WebWorks Developer
*/
Regular Contributor
Asmooh
Posts: 77
Registered: ‎10-27-2010
My Device: Passport SQW100-1

Re: Do i really need to copy menu/actionbar to every file?

i tried, made menu.html and actionbar.html.

 

than i did bb.pushscreen("menu.html",'menu'); before everything is loaded and the same with actionbar after.

but than my app is not loading at all.

 

Developer
anphorea
Posts: 134
Registered: ‎11-27-2012
My Device: Z10 LE,Dev Alpha C

Re: Do i really need to copy menu/actionbar to every file?

I mean, create a template named content.html
Add all the action bar and menu items inside
But left the content div empty
Then push in this html.
/*
WebWorks Developer
*/
BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10

Re: Do i really need to copy menu/actionbar to every file?

BBUI uses your HTML fragments as the primary source to display content to the user. If you push a new screen, anything you were displaying is removed and replaced by the contents of your HTML fragment.

Using the pop/push screen approach, you can not specify a static element between pages when using BBUI.

You can, however, define a screen that shows/hides content based on actions. This is a common approach to a screen with tabs in the Action Bar. Instead of each Tab pushing a new screen, you simply show/hide a specific <div> on the existing page to transition between content. This is the approach that BBUI uses, which you are instead doing manually so as not to lose your current screen's content.

There is an example of this here:
https://github.com/blackberry/bbUI.js/blob/master/samples/bb10/actionBar.htm

Note the tabs that, by default, have display: none.

In the JS file, you can see how they are switching between those panels:
https://github.com/blackberry/bbUI.js/blob/master/samples/bb10/js/actionBar.js

The end result is that your main UI stays the same, with only the content changing, and you don't lose what you currently have on the page.

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.