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
Developer
songdawg
Posts: 59
Registered: ‎06-08-2011
My Device: n/a
Accepted Solution

BBUI.js How to pass text-arrow-list item id to a detail screen

I am using BBUI.js and in my screen I have a text-arrow-list with items.

How do I pass the item data-bb-value to a details screen to retrieve and display more details there?
This may be really obvious but I can't see how to do it and any help would be appreciated.

// Snippet from the list screen. This is fired onclick for the item in the list.
openListItem: function() {
    var value = this.getAttribute('data-bb-value');
    bb.pushScreen('detail.html' + "?id=" + value, 'detail');
}

// This is the load for the detail screen where Iwoudl like to access id
detailScreen = {
    load: function(element) {
    // How do I access the query string from the url in the pushScreen or id from the list?
}

Please let me know if my question is not clear enough. Thanks.

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

Re: BBUI.js How to pass text-arrow-list item id to a detail screen

I don't believe we've added in the ability to pass parameters through pushScreen().

 

You'll need to keep track of global state in your own public object/variable.  For now on the click of the item you would have to save the value in a global object/variable.

 

There is a bb.onscreenready event that you can subscribe to that will fire before the new screen gets processed by the toolkit.. It will pass you the screen element so that you can manipulate it before the styling is applied.

 

There are details in the readme that give more information on how this works.. just do a search on the page for "onscreenready"

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
songdawg
Posts: 59
Registered: ‎06-08-2011
My Device: n/a

Re: BBUI.js How to pass text-arrow-list item id to a detail screen

Thanks Tim for getting back to me - that is a good approach. 

 

Forgive me if this is not the right place or if it is an idea that won't work but would it be possible to add the url as a bb.screen property in bbUI.js? This could be set on loadScreen since the url is already available. Then the url could be accessible to each screen in order parse for the query string.

 

Thanks for all your effort and creativity in creating the BBUI. And I think the new logo is great.