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
New Developer
UserNeo
Posts: 74
Registered: ‎10-23-2008
My Device: 9000
Accepted Solution

bbUI - Change title dynamic?

Hi, how i can change the "data-bb-caption" with javascript/jquery?

 
<div data-bb-type="title" data-bb-caption="dynamicTitle"></div>
 

cu UserNeo

Developer
nunodonato
Posts: 313
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha

Re: bbUI - Change title dynamic?

Hi!

there's a javascript interface to interact with the titlebar. check https://github.com/blackberry/bbUI.js/wiki/Title-Bars

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


New Developer
UserNeo
Posts: 74
Registered: ‎10-23-2008
My Device: 9000

Re: bbUI - Change title dynamic?

But this solutions doesn't work :smileysad: , the result is a blank white page:

 

test.html

<div data-bb-type="screen" data-bb-effect="slide-left">       
    <div id="mytitlebar" data-bb-type="title" data-bb-caption="..."></div>
    <script>
            var titleBar = document.getElementById('mytitlebar');
            titleBar.setCaption('my new caption');
            alert(titleBar.getBackCaption()); 
    </script>
</div>

 index.html

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="css/bbui/bbui.min.css"></link>
        <script type="text/javascript" src="js/bbui/bbui.min.js"> </script>
        <script type="text/javascript" src="js/jquery/jquery.min.js"></script>
        <script type="text/javascript" src="local:///chrome/webworks.js"></script>
        <script type="text/javascript">
        document.addEventListener('webworksready', function(e) {
            bb.init({
                controlsDark: true,
                listsDark: false,
                bb10ForPlayBook: true
             });
            
            bb.pushScreen('test.html', 'vaults');

        }, false);
        </script>
    </head>
    <body>
    </body>
</html>

 

Developer
nunodonato
Posts: 313
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha

Re: bbUI - Change title dynamic?

don't use inline scripting and it works.

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


New Developer
UserNeo
Posts: 74
Registered: ‎10-23-2008
My Device: 9000

Re: bbUI - Change title dynamic?

Thank you :smileyhappy:
New Developer
UserNeo
Posts: 74
Registered: ‎10-23-2008
My Device: 9000

Re: bbUI - Change title dynamic?

Sorry if I ask again :Innocent:, how do I change the contents of a data-bb-type="label" field?

Javascript .innerHTML doesn't work :smileysad: 

 

Sample:

 

<div data-bb-type="round-panel" id="Container"> 
        <div data-bb-type="panel-header">Login</div>
        <div data-bb-type="label-control-container">
            <div data-bb-type="row">
                <div data-bb-type="label">....</div>
            </div>
        </div>      
    </div>

 

Developer
nunodonato
Posts: 313
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha

Re: bbUI - Change title dynamic?

There is no interface to change the label via bbUI. Why would you want to do that, anyway?

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


New Developer
UserNeo
Posts: 74
Registered: ‎10-23-2008
My Device: 9000

Re: bbUI - Change title dynamic?

I've a  javascript array with a lot of error messages, how can I show these messages without data-lists, data-label etc on a page? I only need a simple label field.

Developer
nunodonato
Posts: 313
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha

Re: bbUI - Change title dynamic?

why do you need the label field? just format the html the way you want it.

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