Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Mobile showPageLoadingMsg()/hidePageLoadingMsg() methods not working on initial page loadn
    primarykey
    data
    text
    <p>I am writing a webapp using jQuery Mobile that calls a function to load records into localStorage and create a listview from a remote JSON file when the page is initially created (using the <code>live.pagecreate()</code> event for the page). At the beginning of this function is the jQuery Mobile method <code>$.mobile.showPageLoadingMsg()</code> and <code>$.mobile.hidePageLoadingMsg()</code> is at the end of the function. </p> <p>On the initial pagecreate, the loading message does not appear (on iPhone 4 with iOS 4.3 Safari, Chrome 13 and Firefox 5). However, I also have a refresh button on the page; this button clears the associated records in localStorage then calls the same function used to initially populate the listview. However, when calling the same function from the refresh button the <code>showPageLoadingMsg()</code> and <code>hidePageLoadingMsg()</code> both work correctly and the Loading screen appears and disappears as it should. Am I missing something here?</p> <p><strong>ETA</strong> Here is the gist of the code (not in front of the actual code right now, if you need more I will put it in tonight). I also should mention that I've tried to put showPageLoadingMsg in (document).ready and have tried to bind it to mobileinit and neither have worked:</p> <pre><code>function loadListView(){ $.mobile.showPageLoadingMsg(); //ajax call to pull JSON //$.each loop to load localStorage and listview $.listview.refresh('list'); $.mobile.hidePageLoadingMsg(); } $(#listpage).live('pagecreate', function(event){ loadListView(); // showPageLoadingMsg() and hidePageLoadingMsg do not work when the function is called here }); function clearList(){ //for loop that clears each item in localStorage that matches the key prefix set in loadListView } //runs when refresh button is clicked $('listrefresh').live('click',function(){ clearList(); loadListView(); //showPageLoadingMsg() and hidePageLoadingMsg() work when the function is called here }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload