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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Web and WebWorks Development

Reply
Contributor
AmonRaHR
Posts: 20
Registered: ‎06-12-2012
My Carrier: TELE2 HR

Web Works beginner - parsing JSON & cache

Hi,

I'm new in WebWorks so i need some help from you guys. :Rolleyes:

 

I’m trying to develop application for BB OS 6, 7 and 10 and PlayBook and best solution is WebWorks.

I start with basic news reader parsing JSON from webservice and everything look great news being populated as expected then I call message details using “bb.pushScreen” detail news shown ok but when i go back (with bbUI.js) I need to repopulate everything again which slows down application.

 

Is there any better way of doing this.

 

Thanks

 

Vedran

BB10 Air Developer
Please use plain text.
BlackBerry Development Advisor
oros
Posts: 839
Registered: ‎04-12-2010
My Carrier: Bell

Re: Web Works beginner - parsing JSON & cache

Hello Vedran,

 

When you say "repopulate", do you mean that the content is being loaded back in, or do you mean that you are reconnecting to the external server and requesting the data again?

 

Since bbui.js loads all "screens" into the same page, the content will need to be brought back in by the framework once you switch back. However, you should be able to use the content that's already been requested / loaded. I don't think it would be necessary to reach out to the server and request new data on each screen load.

 

Does that make sense?

Please note that I will be unavailable between May 19th and June 4th. Sincere apologies for any delays during this time. I will do my best to follow-up as soon as I am able.

Erik Oros
BlackBerry Development Advisor
@WaterlooErik
Please use plain text.
Contributor
AmonRaHR
Posts: 20
Registered: ‎06-12-2012
My Carrier: TELE2 HR

Re: Web Works beginner - parsing JSON & cache

Hello,

 

Thanks for answer,

 

I tap on menu (back) (from bbui.js generated menu) and my content disappears from previous screen, so I need to reconnect to external server and request data again.

I’m glad to hear that and that make sense. I will try to write clean app with last build of bbui.js for just this and see if it works.

 

Vedran

BB10 Air Developer
Please use plain text.
Developer
rorybarnes
Posts: 214
Registered: ‎01-07-2011
My Carrier: Rogers

Re: Web Works beginner - parsing JSON & cache

Why not store the data in localStorage after the first request with an expires timestamp (5 minutes in the future maybe)?Then if your user navigates to a different screen and comes back the original one the app would check is the expires time, if it is still valid it loads the local data, if it expired then go to the remote source.

 

Rory

--
Rory (@roryboy)
Click "Accept as Solution" if post solved your original issue. Give like/thumbs up if you feel post is helpful
Please use plain text.
Contributor
AmonRaHR
Posts: 20
Registered: ‎06-12-2012
My Carrier: TELE2 HR

Re: Web Works beginner - parsing JSON & cache

Hi Rory,
Yes that is solution that i will make but bbui have power of everythin on one screen.

I test clean app with last sdk and it not work.
I will post my code here latter today for u guys to see if i'm doing something wrong.

Vedran
BB10 Air Developer
Please use plain text.