- This topic has 3 replies, 2 voices, and was last updated 11 years, 1 month ago by support-octavio.
-
AuthorPosts
-
FumioUedaParticipantI am challenging to make an app using multipage widget with localstorage.
It is near completion.
Last challenge is to make user can select “default page” (=start page) of the multipage.
If it was done, its user would be very convinient because of less tapping to reach the target page.
Please comment me how to change “Default Page” to “another page” of multipage widget in a programmatic manner, if possible.
support-octavioMemberHi ueda,
This approach might help you.
Use a global var (i.e. currentPage) to be saving the value of current multipage page:
var currentPage; //add this on custom.js file
On the onPage Changing action you will set the value of this var, everytime that the page is changed:
currentPage = $(newPage).attr("id");
To make default a page, associate next code to a button in a multipage page:
localStorage.setItem("default", currentPage);
Then in the phoneui.documentReadyHandler function in your _custom.js file you pull this default var and navigate inmediately to the last page that was set as default:
var default_mpp = localStorage.getItem("default"); //get id of saved default page if(default_mpp) // check if there's already saved an id, if not, is not necesary to do the transition phoneui.gotoMultiPagePage('m1-mptest-multiPage1', 'SET_PAGE', default_mpp, 'NONE'); //you should change the first parameter with the name of your project and multipage widget id: 'm1-<project>-<multipageWidgetID>
FumioUedaParticipantHi Octavio,
Thank you for the quick comment.
I struggled several days about [phoneui.gotoMultiPagePage] function you commented .But finally, I got over the wall. It worked perfectly.
Impotant point was third parameter description of the function.
(fefore) ‘default_mpp’ => (after) ‘m1-mptest-‘+’default_mpp’So would you please close this topic.
Thanks a lot.
ueda
support-octavioMemberHi ueda,
Glad you got it working now. Apologies for not sharing detailed instructions for parameters. Thread closed.
-
AuthorPosts