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

Native Development

Reply
Developer
Posts: 426
Registered: ‎04-10-2011
My Device: Z30

Navigation push data

Why isn't there some better mechanism to push data between subsequent Pages? e.g. for Master-Details views. Using only QML!

 

The "best" solution I could find using the current way it works, it creating a property in the NavigationPane or the current page, which can be read by the pushed Page. In my opinion this is really ugly because the first page shouldn't hold the data – the Page actually using the data should have receive and hold the data.

(Inspired of course by one of the samples!)

 

Usually, I'm used to having something better like:

nav.push(page, data)

Even the bbUI.js framework supports thisbb.pushScreen('page.htm', 'screenId', {'hello': 'world', 'foo': 2});

Why not include it in Cascades/QML/native APIs too?!

-----------------------------------------------------------------------------
Check out my apps in the BlackBerry World
Visit my developer blog alopix.net
BBM Channel: C0047B612
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Navigation push data

Aren't you using signals to pass data around between the pages, or between your backend code and a given page?

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 426
Registered: ‎04-10-2011
My Device: Z30

Re: Navigation push data

I'm currently not using signals at all, because I'm the app is very simple and I'm not really satisfied with the way RIM designed the whole UI-BL/MVC stuff Smiley Sad
Maybe I have to take a deeper look at what they changed in the last beta but I couldn't see any difference to how it was before.
-----------------------------------------------------------------------------
Check out my apps in the BlackBerry World
Visit my developer blog alopix.net
BBM Channel: C0047B612
Developer
Developer
Posts: 174
Registered: ‎03-05-2009
My Device: Dev Alpha
My Carrier: -

Re: Navigation push data

well you have to add a property within the page, so it is not one line but two lines of code:

 

var page = pageDefinition.createObject();
page.data = {'hello': 'world', 'foo': 2};
nav.push(page);
...
ComponentDefinition{
 id: pageDefinition
 Page {
   property variant data //this is your page context property
 }
}

 

 not the best i agree, but very acceptable imho.

 

 

Contributor
Posts: 18
Registered: ‎07-24-2013
My Device: BLackberry 10
My Carrier: Mobile Apps developer

Re: Navigation push data

Simple and Easy , Thanks !!!