facebook

question about documentReadyHandler

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

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

    dabbelju
    Member

    Hi all,

    Let’s assume I have an APP with 3 screens and the same nav bar at the bottom of each screen in order to navigate between them.

    My hope was, that the documentReadyHandler is fired each time I do navigate to a screen. But obviously this is not the case.

    In the documentReadyHandler I want to load data and display it.

    The only time that the documentReadyHandler is fired is when I do start the app in the test center and only for the screen which I start (if I start screen 1 in Test Center it is fired for screen 1).

    Do I do something wrong or is my expectation wrong?

    Or is there any other way to take action everytime I switch to a screen?

    Thanks and best regards
    Dabbelju

    #327891

    Max87
    Member

    Hi dabbelju,
    I think you can create button, set it’s onclick action to javascript and into function put code like this
    function gotoScreen2()
    {
    //your code that will run before transition to next page(as it would be in documet.ready for targeted page)
    phoneui.gotoPage(‘m1-screen2’,phoneui.transitions.SLIDE_LEFT); //this would transfer you to targeted screen with slide left animation
    }

    Let me know if it works for you.

    #327915

    dabbelju
    Member

    Hi Max87,

    thanks for your thoughts. That would exactly meet my requirements. I did try it out yesterday and for whatever reason it does not work in all cases. I will try to figure out, why it does not work.

    If found this thread here in the forum and it seems to me that this might be the problem.

    http://www.genuitec.com/support-genuitec/viewtopic.php?f=8&t=2149&p=8500#p8500

    thanks and best
    Dabbelju

    #327916

    Max87
    Member

    Personally I use “hack” with hidden Link widget very often, exactly as Wayne described and it’s working fine.
    Can you more describe your problem?(that “hack” is not working?) or share your project?
    Thanks

    #327917

    will
    Member

    im very new to java but it think this works.

    The follow should be put in the pagename_custom.js that can be made by clicking generate source files in the design view. this must be done from your homepage.
    in phoneui a trigger e.g

    phoneui.prePageTransition = function(currentPageId,targetPageId) {
    // add custom pre-transition code here
    // return false to terminate transition
    {
    FunctionA();
    }
    return true;
    }

    then in document ready handler:
    phoneui.documentReadyHandler = function() {
    }

    function FunctionA() {
    YOUR CODE HERE
    });

    FUNCTION A SHOULD FIRE BEFORE EACH PAGE SWITCH

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: question about documentReadyHandler

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