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


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: 36
Registered: ‎12-12-2013
My Device: Blackberry Z10
My Carrier: Vodafone

calling the datamodel globally

Hi all,

 

I wanted a datamodel object globally across the qml pages.

I querried from sqlite and result stored in datamodel . this same datamodel values i wanted to access from page 3 , page 4 etc. (how to make that datamodel object available globally)

Developer
Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: calling the datamodel globally

You could make it available in your main.qml, for example.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 36
Registered: ‎12-12-2013
My Device: Blackberry Z10
My Carrier: Vodafone

Re: calling the datamodel globally

[ Edited ]

Hi simon,

 

  can you please eloberate.. I am new to blackberry so please suggest some examples on this..

 

Thanks

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: calling the datamodel globally

What Simon is saying is that you could create your dataModel in the main.qml, if you then give it an id it should be accessible from any qml file after that by referencing that id.

 

So if you are using a navigationPane for instance you could reference it by;

 

      <navigationPaneId>.<dataModelId>

 

in every page you push on to the stack.

 

Alternatively you can use a Qt global variable

 

      Qt.dm = <dataModelId>


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
New Developer
Posts: 36
Registered: ‎12-12-2013
My Device: Blackberry Z10
My Carrier: Vodafone

Re: calling the datamodel globally

 

 

Got error

TypeError: Result of expression 'navigationPane.defaultModelMain' [undefined] is not an object

 

Thanks

Developer
Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: calling the datamodel globally

where specifically do you get this error?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter