I've been at this for hours now and it's probably a very stupid mistake on my part, but for some reason I can't get this listview to refresh. I'm using JQuery Mobile (1.4.5), and I'm building a mobile web app. I've tried to initialize my list in my index.html like so:
<div data-role="content" id="ulListView">
<form id="newSearch"><input type="search" placeholder="Enter a written work" name="search-mini" id="search" data-mini="true" /></form>
<ul id="list" data-role="listview" data-inset="true"></ul>
</div>
I use my list to grab JSON and then append results to the list. I'm doing that like so [Javascript]
... foreach JSON loop up here [Tested working]
var listItem = '<li>' + entry.title + '</li>';
console.log("listItem " + listItem);
$("#list").html(listItem);
console.log("Appended " + '<li>' + entry.title + '</li>' + " to list");
});
$("#list").listview('refresh');
So far, I feel as if I've tried everything, from listview().listview('refresh'), using the "create" method, placing code inside or outside of the loop, using the div id instead of the ul id, various JSFiddle examples, posts here on StackOverflow, etc.
Once again, I'm sure it's just something stupid I forgot to look at, but I can't seem to find the issue! I'm very grateful for any help you guys can give me.
Thanks again! :)
Aucun commentaire:
Enregistrer un commentaire