Loading 200 items and storing them is not a good phone / corridor approach. We are talking about the already slow HTML5 + JS shell, this will make it even slower.
A better approach would be to use ajax to load more data, the ajax call will fire when you reach the end of the list or when the "load new content" button is clicked.
Here you will find the “upload new content” button approach:
http://jsfiddle.net/knuTW/2/
Here you will find an approach with an automatic download list when you reach the end of the list:
http://jsfiddle.net/dhavaln/nVLZA/
This example requires this jQuery plugin: http://imakewebthings.com/jquery-waypoints/
And here is my example with listview and $ .ajax startup in combination:
http://jsfiddle.net/Gajotres/v4NxB/
Sample code, and I repeat that this is just a dummy example (a dummy example still working):
// load test data initially for (i=0; i < 10; i++) { $("#list").append($("<li><a href=\"index.html\"><h3>" + i + "</h3><p>z</p></a></li>")); } $("#list").listview('refresh'); // load new data when reached at bottom $('#footer').waypoint(function(a, b) { // Load some dynamic data with $.ajax $.ajax({url: "http://api.themoviedb.org/2.1/Movie.search/en/json/23afca60ebf72f8d88cdcae2c4f31866/The Goonies", dataType: "jsonp", jsonpCallback: 'successCallback', async: true, beforeSend: function() { $.mobile.showPageLoadingMsg(true); }, complete: function() { $.mobile.hidePageLoadingMsg(); }, success: function (result) { ajax.parseJSONP(result); }, error: function (request,error) { //alert('Network error has occurred please try again!'); } }); $('#footer').waypoint({ offset: '100%' }); }, { offset: '100%' }); var ajax = { parseJSONP:function(result){ //var jsonObj = jQuery.parseJSON(parameters); $("#list").append('<li>Movie name:<span> ' + result[0].original_name+ '</span></li>'); $("#list").append('<li>Popularity:<span> ' + result[0].popularity + '</span></li>'); $("#list").append('<li>Rating:<span> ' + result[0].rating+ '</span></li>'); $("#list").append('<li>Overview:<span> ' + result[0].overview+ '</span></li>'); $("#list").append('<li>Released:<span> ' + result[0].released+ '</span></li>'); $("#list").listview('refresh'); } }
You also need to prevent another call to $ .ajax to the last.
source share