facebook

Changing "Default Page" of multipage programmatically:CLOSED

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #342770 Reply

    FumioUeda
    Participant

    I 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.

    #342774 Reply

    Hi 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>
    #342921 Reply

    FumioUeda
    Participant

    Hi 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

    #342934 Reply

    Hi ueda,

    Glad you got it working now. Apologies for not sharing detailed instructions for parameters. Thread closed.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Changing "Default Page" of multipage programmatically:CLOSED

You must be logged in to post in the forum log in