facebook

How to reload automatically a page

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

    Albatros78
    Participant

    Hi all,

    I would like reload automatically one specific page of my project.
    When the project is generated by MB1 we need to refresh the div which is corresponding to our page.

    I tried different solution with Ajax or other functions with no success.

    Does anyone has a sample working fine ?

    Wayne, what’s the exact syntax to do that into _custom.js file

    Thanks a lot

    #323691 Reply

    support-michael
    Keymaster

    @Albatros78

    This function will relayout a screen: phoneui.preprocessDOM(screenId)

    To find the screenIds in you html file look for all divs with the CSS class m1-root or just root

    See attachment pageid.png

    
    //Example: 
    phoneui.preprocessDOM("m1-test");
    
    Attachments:
    You must be logged in to view attached files.
    #323693 Reply

    Albatros78
    Participant

    But how to configure by example an automatic refresh each x second or minutes ?

    #323696 Reply

    support-michael
    Keymaster

    @Albatros78

    Ah! I’ve not thought about that in past. What is your scenario/story?

    Perhaps a javascript timer e.g., (setTimeout(millis), clearTimeout(timerId) )?

    For a multi-screen webapp, I don’t think http protocol could be used to refresh page at regular interval, e.g., <META HTTP-EQUIV=”REFRESH” CONTENT=”1″>

    #323697 Reply

    Albatros78
    Participant

    I continue to work with my chart library.

    In fact the chart id designed by an external xml file which content any values to display my chart.
    And the xml file can be updated by external script directly on the web server.

    So, the idea is to reload the div to display new values of my chart.

    I’m not sure if the syntax <META HTTP-EQUIV=”REFRESH” CONTENT=”1″> works because this action reload ALL html file. In fact the complete webapp in this case.

    And if I do that probably I go back directly to the home page and not on my specific page (different screen) into my webapp.

    Thanks for your help.

    Hope to be clear

    #323706 Reply

    Albatros78
    Participant

    Hi Wayne,

    I found how to fix my issue.

    In fact my charting values are inside js file which is loaded into my html with an include like:
    <script type=”text/javascript” src=”data/cylinder1.js” ></script>

    And the JS function is into my _custom.js file and displays charting with values read from the include at first loading
    The difficulty is to reload this include automatically
    I tried setTimeout javascript function but just my function is reload with same values at initial.

    To fix this issue I configure my function to get charting values not from a js file by include but directly from a XML file, read into my function
    and now when I refresh my function the xml file is reloaded correctly at each time.

    Works fine. very nice

    Just for info and how to reload automatically the function itself the syntax is:

    function Myfunction();{
    var t1;
    t1=setTimeout(“Myfunction ()”,5000);

    }

    Regards

    #323707 Reply

    Albatros78
    Participant

    Wayne, one thing

    With this solution, when I click on my “back” button I need to clear my timer with a command ClearTimeout(t1);

    But what is the JS function to add into _custom.js file to execute thie command for each “back” action for any page.

    Does a function like that exists:

    phoneui.goBack = function(Goback)

    Thanks for your help

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: How to reload automatically a page

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