Melvin Tan Gim Huat
Posts: 0
Joined: Sun Oct 14, 2012 11:58 pm

When returning to a previous screen, how do I load the screen exactly where the user left off earlier?

I have a summary screen that will load 25 items. The user can scroll up and down this summary screen. Clicking any of the items will bring the user to another screen.

Now, when the user navigates back to the summary screen, I need the summary screen to be loaded exactly where the user left off previously.

How do I do that?

Thank you.

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

When returning to a previous screen, how do I load the screen exactly where the user left off earlier?

jQuery Mobile might have a feature for that but you can try to add a anchor to the place in page you want to jump when you go back.

Melvin Tan Gim Huat
Posts: 0
Joined: Sun Oct 14, 2012 11:58 pm

When returning to a previous screen, how do I load the screen exactly where the user left off earlier?

Does Tiggzi provide this option?
Otherwise, would you happen to have sample code to share?

Thanks.

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

When returning to a previous screen, how do I load the screen exactly where the user left off earlier?

This feature would need to be coded. I don't have any sample code to share.

Eric5020946
Posts: 0
Joined: Tue Sep 18, 2012 4:31 pm

When returning to a previous screen, how do I load the screen exactly where the user left off earlier?

add CLICK event to each item on your list, when user clicks item, update localstorage variable with ID of the item

add new action CUSTOM JS for event PAGE SHOW or LOAD depends on your project structure, in this action set focus to ID stored in localstorage variable, should work

Melvin Tan Gim Huat
Posts: 0
Joined: Sun Oct 14, 2012 11:58 pm

When returning to a previous screen, how do I load the screen exactly where the user left off earlier?

Thanks Eric. I understand the concept but am unsure how to implement the part on "set focus to ID stored in localstorage variable".

In Custom JS, how do I implement the above in ""?

Thank you.

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

When returning to a previous screen, how do I load the screen exactly where the user left off earlier?

Hi !
This will work if your Project is a Multi-page design.
On each of your Buttons add this custom Js on "Click " in Properties Tab
codevar button = $(this).attr('dsid');
localStorage.setItem('lastbutton', button);
Tiggzi.navigateTo('pagebuttonClickToGoTo',{ transition: 'none'});/code

Now add this custom Js to the screen(with the buttons) using "Page Show"
codevar button = localStorage.getItem('lastbutton');
Tiggzi(button).focus();/code

If a single page template design. Use this code on "Page Show" instead..
codevar button = localStorage.getItem('lastbutton');
setTimeout(function() {Tiggzi(button).focus();},500);/code

Now when the user goes to this page it will jump to last clicked button !
Hope it works for you.
Regards.

Melvin Tan Gim Huat
Posts: 0
Joined: Sun Oct 14, 2012 11:58 pm

When returning to a previous screen, how do I load the screen exactly where the user left off earlier?

Hi Neil,

Thanks for the code. I tried the multipage code but it did not work. I'm not sure if it is due to the Tiggzi update bugs (I notice we are interacting in a related thread) or something else that I'm doing wrong.

As I'm going through the logic to debug, I understand your code but don't really understand the line "Tiggzi(button).focus();". This looks like it is part of the Tiggzi API, but when I searched for this on the tiggzi API page, I couldnt find it and hence, am not sure how to use this.

Is there a placeholder in this line of code you provided that I need to change?

Thank you.

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

When returning to a previous screen, how do I load the screen exactly where the user left off earlier?

button - is the component name. Tiggzi('id') is a short cut to getting a reference to jQuery Mobile element. You can always use jQuery directly.

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

When returning to a previous screen, how do I load the screen exactly where the user left off earlier?

button is the variable name I used. Value of "button" is set from local storage.
Local storage button id is set when button is clicked.
I tested this morning on tiggzi chrome and firefox. Works fine.
Maybe add some console.log to see it work? May help to debug.
eg.
code
var button = localStorage.getItem('lastbutton');
console.log(button);
Tiggzi(button).focus();/code

The Important thing is to ensure use use your own screen name where I put "pagebuttonClickToGoTo".

Return to “Issues”