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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Developer
Posts: 77
Registered: ‎10-23-2008
My Device: 9000

bbUI - Add dynamic content?

Hi,

 

i use the wonderful bbUI framework for my webworks projects Smiley Very Happy .

 

Now, i have a little problem, how i can add dynamic content into the image-list?

 

history.html

<div data-bb-type="screen" data-bb-effect="fade">
	<div data-bb-type="title" data-bb-caption="history" ></div>
	<script id="callJS" src="js/call.js"></script>
        <div data-bb-type="image-list" id="history"> </div>
</div> 

 call.js

function getCallLogs() {
  	var found = blackberry.phone.PhoneLogs.find(null, blackberry.phone.PhoneLogs.FOLDER_NORMAL_CALLS, "date", 20, false);
   	if (found) {
    	     for (i = 0; i < found.length; i++) {
    		if(found[i].number != null)	{
    			var html = '<div data-bb-type="item" data-bb-img="images/history.png" data-bb-title="' + found[i].name + '">' + found[i].number + '</div>';
    			document.getElementById("history").innerHTML = document.getElementById("history").innerHTML + html;
    		}
    	     }
  	}
}

getCallLogs();

 this doesn't working Smiley Sad , have anyone a fix or correct code snippet for me?

 

 

cu

UserNeo 

Developer
Posts: 51
Registered: ‎10-22-2011
My Device: 9800
My Carrier: Telus

Re: bbUI - Add dynamic content?

[ Edited ]

I can't help on bbUI at all but here are a couple of, possibly minor, comments on your code.

 

First, avoid the "id" attribute on the script - it is unnecessary and causes problems in some browsers.  I suspect that is why your code isn't working.  Stylistically, I'd move the script element outside the div and probably put it in the head section but that is personal preference.

 

Secondly, as a matter of efficiency, I'd slightly redo your JS code.  Instead of extracting and appending to the innerHTML, you might find it faster to use DOM operations to create the per-item div and then use the appendChild method of the history div.

 

Finally, with these changes, you probably only want to call your function to get the call log after the page has loaded.   Use window.addEventListener("load", getCallLogs,0) or something similar.

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: bbUI - Add dynamic content?

Here's a thread on github that may help out

 

https://github.com/blackberry/bbUI.js/issues/28

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
Posts: 134
Registered: ‎05-19-2012
My Device: Torch 9800, PlayBook 64GB, Dev Alpha
My Carrier: VIVO Brazil

Re: bbUI - Add dynamic content?

I wrote a tutorial about this to clarify everything for beginners: Tutorial: Using bbUI's onscreenready and ondomready to Dynamically Change Your HTMLSmiley Happy

If I helped you please click the "Like" button to support my work.
My apps: CherryNotes - Bookmarked - Requests
Social Me: about.me - Twitter
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: bbUI - Add dynamic content?

Very cool... We're thinking about moving those events to the screen object to make things cleaner and more modular in your app code

 

https://github.com/blackberry/bbUI.js/issues/186

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Highlighted
Developer
Posts: 134
Registered: ‎05-19-2012
My Device: Torch 9800, PlayBook 64GB, Dev Alpha
My Carrier: VIVO Brazil

Re: bbUI - Add dynamic content?

That will be awesome to see since at the time a bb.init() statement on a project I'm working on is crazy to understand with all those if statements to each screen.

 

0.9.3 will be a huge update to bbUI as I can see. Smiley Happy

If I helped you please click the "Like" button to support my work.
My apps: CherryNotes - Bookmarked - Requests
Social Me: about.me - Twitter