- This topic has 1 reply, 2 voices, and was last updated 10 years, 10 months ago by Brandon.
-
AuthorPosts
-
TorbenKjeldgaardMemberHi,
I’m having some problems with my list – it’s slow and jumpy. It contains aprox 50-250 items. If it’s under 15-20 items it’s okay – but not impressing.
In short here is what I do.
I get a jsonfile from my server and load it into local storage. From local storage I build the list using the code below.
I found a post where support suggested to change the page to “Remote Web Page” but it seems like it getting even slower if I’m doing that.
I would appreciate any input to fix the issue.
By the way – I’m getting my app refused on the amazon store – when they test it on kindle, they can not login!!!! Any suggestions?
function render_list( container_id ) { if(container_id == 'm1-listnearby'){ var jsonstr = window.localStorage.getItem('tds.dk_data_nearby'); list_items = JSON.parse(jsonstr); } if(container_id == 'm1-listdeal'){ var jsonstr = window.localStorage.getItem('tds.dk_data_deal'); list_items = JSON.parse(jsonstr); } if(container_id == 'm1-listevent'){ var jsonstr = window.localStorage.getItem('tds.dk_data_event'); list_items = JSON.parse(jsonstr); } if(container_id == 'm1-listnews'){ var jsonstr = window.localStorage.getItem('tds.dk_data_news'); list_items = JSON.parse(jsonstr); } if(container_id == 'm1-listfav'){ var jsonstr = window.localStorage.getItem('tds.dk_data_fav'); list_items = JSON.parse(jsonstr); } var container = $("#" + container_id); var list = $("ul[class*=m1-list]" , container); var clone = $("li:first" , list).clone(); var list_height = list.outerHeight(); //$("li" , list).remove(); // <-old list.children("li" ,list).remove(); // <-New var length = list_items.length; var item = null; //put mypos into items array-> items.length = 0; items.push({lat:localStorage.getItem('tds.dk_mylat'),lng:localStorage.getItem('tds.dk_mylng'),selItem:0,itemid:'Me',itemhead:'Me',locname:'My position',center:'yes',mapicon:markerIconMe}); //put mypos into items array<- for (var i = 0; i < length; i++) { item = list_items[i]; $(clone).removeClass("m1-first m1-last"); //put itempos into items array-> items.push({lat:item['lat'],lng:item['lng'],selItem:i,itemid:i,itemhead:item['head'],locname:item['loc_name'],center:'no',mapicon:markerIcon}); localStorage.setItem('tds.dk_mapmarkers',JSON.stringify(items)); //put itempos into items array<- if(i == 0) $(clone).addClass("m1-first"); if(i == length-1) $(clone).addClass("m1-last"); $(clone).attr("data-listitem-index" , i); if(item["img"]){ $("div[id*=txtImg]",clone).html('<img src="'+item["img"]+'" width="60" align="top">'); } $("div[id*=txtHead]" ,clone).text(item["head"]); //All $("div[id*=txtDist]" ,clone).text(item["dist"]); //All $("div[id*=txtDisc]" ,clone).text(item["disc"]); //Deal, Event & News List $("div[id*=txtCat]" ,clone).text(item["cat"]); //Nearby List $("div[id*=lat]" ,clone).text(item["lat"]); //All $("div[id*=lng]" ,clone).text(item["lng"]); //All list.append($(clone).clone()); } var panel_ht = list_height * length + 15; $("div[id*=scroller]" , container).attr("data-layout-content-height", panel_ht); phoneui.preprocessDOM(list); phoneui.forceLayout(); }
BrandonMemberI dont have a lot of time to go through your code right now, but, it must be something else. I have a list that uses a XML file with 115 items and it doesnt have a problem with speed, it works great. I am pulling from a local file, maybe you should try using a local file and see if its still slow. If it is maybe break you process into smaller functions where you can narrow it down easier. Sometimes you can use alerts for this, but not always.
-
AuthorPosts