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
Highlighted
Developer
Posts: 1,452
Registered: ‎11-06-2009
My Device: Torch 9810
My Carrier: WiFi
Accepted Solution

How to "persist" screen state?

[ Edited ]

Hi,

 

Sorry if this question have been asked before but I haven't found any relevant information.

 

Here is my issue. I have a WebWorks app built with BBUI.js. On the first screen there is search functionality, after the search is performed, list of items is presented to the user. Once the user clicks on a item, new screens open with additional information. IMO pretty straightforward approach. However when I press the Back button, the screen below (first screen) is in its initial state - no search results, even no search word in the search field.

 

Is it how WebWorks/BBUI is supposed to work or am I doing something wrong? How can I "persist" the screen state, so when users clicks the Back button he/she can see the results of the search?

 

Thank you!



"When you become a level 3 developer, you learn to communicate over the ether. I'm told that level 5 developers are ascend into a higher level of existence beyond the physical realm." gord888 @ crackberry
New Contributor
Posts: 2
Registered: ‎08-05-2013
My Device: 102
My Carrier: abc

Re: How to "persist" screen state?

I think that question will be answered soon, and I want www.kizi-2.net  on your screen all. thanks

BlackBerry Development Advisor
Posts: 761
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: How to "persist" screen state?

Hello,

 

I don't think you're doing anything wrong here, this is the way bbUI.js was built. It does not currently cache/persist/etc screen states when you switch between tabs. 

 

The best way I can think of off the top of my head would be for you to manually cache the current view (localStorage is always fast and easy to use), then display that cached view when the user click on the tab again.

New Contributor
Posts: 7
Registered: ‎03-18-2013
My Device: Torch 9800
My Carrier: T-Mobile

Re: How to "persist" screen state?

I had a similar problem with my maps app and found a solution to it. I simply create a DOM object for the screen and store the Google Maps object in a variable and when the screen is reloaded, I check if a map already exists in which case I don't create a new one but append the existing map to the DOM instead:

 

In your case, you would store all the search states in the Javascript screen object. When you return to your original screen you have to refresh/create the first screen from the DOM object.

 

Please follow the link below for details on the discussion and solution.

 

http://supportforums.blackberry.com/t5/BlackBerry-WebWorks/App-using-BBUi-js-loss-of-information-whi...

 

Thanks,

Suresh