magicfrankie
Posts: 0
Joined: Tue Oct 09, 2012 2:07 am

Workaround for local storage

Hi,

Developers at applicationcraft.com have confirmed that apple has broken local storage functionality. According to apple, they have done this so that localstorage is not backed up to icloud and as a result it gets deleted.

Is there a permanent workaround for this?

Also, the navbar isn't functioning properly for me. If I click on the third button it goes to the third screen but the highlight stays on the second tab or first tab. Is there a fix for this?

Thanks,

Frank

Agon Bina
Posts: 0
Joined: Thu Oct 04, 2012 5:01 am

Workaround for local storage

That's some very bad news for us all. I'd like to know if there is any workaround for this too

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Workaround for local storage

Hello!

http://community.phonegap.com/nitobi/...

http://docs.phonegap.com/en/2.0.0/cor...

As for NavBar it's how jQuery Mobile works.

You load Page 1 with a NavBar component. The first tab is selected. The page is now in browser DOM.
You click on the 2nd tab. jQuery Mobile makes the 2nd tab active and then loads Page 2.
On Page 2, the 2nd tab is active.
On Page 2, you click on 1st tab to go back.
Page 1 was already loaded and is now in browser DOM. As the page is in the DOM, it is simply shown (not loaded). Its last state - 2nd tab was active (from navigation).

As a workaround try to put this JS on Page Show event

var navbar = $("[data-role='navbar']:visible");
if($('.tg-state-persist', navbar).length == 0) {
$(".ui-btn-active", navbar).addClass('tg-state-persist');
} else {
$(".ui-btn-active", navbar).removeClass('ui-btn-active');
$(".tg-state-persist", navbar).addClass('ui-btn-active');
}

magicfrankie
Posts: 0
Joined: Tue Oct 09, 2012 2:07 am

Workaround for local storage

Hi Max,

RE: size/lenth attribute for a number field.

This is what I've done:

  1. I highlighted an input field.

  2. I clicked on 'more options'.

  3. Typed in size and then clicked 'Add'.

  4. Then put 5 as the value.

  5. Clicked OK.

  6. Tested app in browser and on my android and it did not limit input to 5 digits.

    RE: Navbar not working correctly

  7. I have placed three tabs on the navbar.

  8. On screen 1 tab 1 is 'Active'. Tab 2 & 3 are not active.

  9. On screen 2 tab 2 is 'Active'. Tab 1 & 3 are not active.

  10. On screen 3 tab 3 is 'Active'. Tab 1 & 2 are not active.

  11. On 'Page Load' of each screen I have placed the code you provided.

  12. The app starts on tab1.

  13. I click on tab2 and it goes to screen2 and tab2 becomes active.

  14. I click on tab3 and it goes to screen3 and tab3 becomes active.

  15. I click on tab2 and it goes to screen2 and tab2 becomes active.

  16. I click on tab1 and it goes to screen1 but tab2 stays active and not tab1.

    Any help would be great. Thanks.

    Frank

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Workaround for local storage

I think the attribute is called 'maxlength' -- to limit the input length.

magicfrankie
Posts: 0
Joined: Tue Oct 09, 2012 2:07 am

Workaround for local storage

Thanks Max.

You didn't answer the second part of my question as follows:

RE: Navbar not working correctly

  1. I have placed three tabs on the navbar.

  2. On screen 1 tab 1 is 'Active'. Tab 2 & 3 are not active.

  3. On screen 2 tab 2 is 'Active'. Tab 1 & 3 are not active.

  4. On screen 3 tab 3 is 'Active'. Tab 1 & 2 are not active.

  5. On 'Page Load' of each screen I have placed the code you provided.

  6. The app starts on tab1.

  7. I click on tab2 and it goes to screen2 and tab2 becomes active.

  8. I click on tab3 and it goes to screen3 and tab3 becomes active.

  9. I click on tab2 and it goes to screen2 and tab2 becomes active.

  10. I click on tab1 and it goes to screen1 but tab2 stays active and not tab1.

    Thanks

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Workaround for local storage

Let me know if this helps: https://getsatisfaction.com/tiggzi/to...

magicfrankie
Posts: 0
Joined: Tue Oct 09, 2012 2:07 am

Workaround for local storage

Hmmm,

I'm confused now.

What am I supposed to do?

Am I supposed to add the following;

Code: Select all

 data-role="footer" 
 data-id="name"  
 data-position="fixed" 

in the 'more properties' section for just the footer or for the navbar component or for each tab in the navbar?

Regards,

Frank

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Workaround for local storage

Hello! You should add next JS code on Page Show event on each page where you have NavBar

var navbar = $("[data-role='navbar']:visible");
if($('.tg-state-persist', navbar).length == 0) {
$(".ui-btn-active", navbar).addClass('tg-state-persist');
} else {
$(".ui-btn-active", navbar).removeClass('ui-btn-active');
$(".tg-state-persist", navbar).addClass('ui-btn-active');
}

Also select MobileNavBarItem which you want to be highlighted and in Properties check "Active" checkbox.

magicfrankie
Posts: 0
Joined: Tue Oct 09, 2012 2:07 am

Workaround for local storage

Hi,

I worked out why it wasn't working.

I had the js in 'page load' and it didn't work. But, then I put the code in 'Page Show' and it worked.

What is the difference between 'Page Show' and 'Page Load'?

Regards,

Frank

Return to “Issues”