Page 1 of 1

Adding users/login interferes with my mobilelist's session state

Posted: Wed May 07, 2014 12:29 am
by Mycole Beeson

I have two pages. First page is search. The second is the record detail. My mobilelist on the first page saves its state and appears just as when I left it when I go back to it as expected.

UNTIL I add a login page. Now, anytime I leave the search page and return to it (via back button) the search page re-initializes as if I'm starting over.

How can I fix my session stuff to make my mobilelist keep state?


Adding users/login interferes with my mobilelist's session state

Posted: Wed May 07, 2014 1:50 am
by Yurii Orishchuk

Hi Mycole.

It's hard to say exactly why you have this behaviour.

But there is a common reason:

You initialize the page(invoke list service) on "page show" event.

For you know "page show" event triggers every time you visit a page.

If you need other event which is triggers only one time(when page has been loaded) you can to use "Page load" event.

See details on this screen shot http://prntscr.com/3gwz49/direct

Regards.


Adding users/login interferes with my mobilelist's session state

Posted: Wed May 07, 2014 3:39 am
by Mycole Beeson

Hi Yurli,

Thank you for your reply. I did check to make sure I don't have any load events for page show. I definitely do not.

The reason I'm sure it has nothing to do with this is that if I switch my start page from the Sign In page back to the search page and make no other changes, the search results maintain state as expected again.

Could the mobile list's state somehow be messed up by user session variables?

I've made a short video demonstrating the issue. I first show the expected behavior by bi-passing the sign-in screen. Then I start with the sign-in and show that mobile list looses its state.

https://www.youtube.com/watch?v=KsSzE...

Michael


Adding users/login interferes with my mobilelist's session state

Posted: Thu May 08, 2014 2:14 am
by Yurii Orishchuk

Hi Michael.

Thanks for your detail description and video.

Ok, it was not a problem with login processing. But with jqm dom caching was.

So to do what you want you should to enable jqm caching.

Please do following steps:

1 Create JS asset.

2 Populate this asset with following code: http://prntscr.com/3h7vbs/direct

pre
code

var onLoad = function(){
$.mobile.page.prototype.options.domCache = true;

};

jQuery(window).bind("load", onLoad);

/code
/pre

That's all

Regards.


Adding users/login interferes with my mobilelist's session state

Posted: Thu May 08, 2014 2:26 am
by Mycole Beeson

You are brilliant. It works perfectly now. Thank you!