I'm probably doing something stupid but I can't figure this out for the life of me. I have a list in Jquery Mobile formatting. I create the list elements programmatically in a for loop from a table.
The first time the list is displayed from the function call, it displays properly with JQuery Mobile formatting and following the theme. However, if the function is called a second time, or more, the list reverts to standard HTML formatting with a blue underlined link.
Here is the code:
var createlist = function()
{
window.$("#searchresults").html(resultsstring);
var htmlstring = "";
for (var i = 0; i<resultsarray.length; i++)
{
var eventtime = resultsarray[i].eventtime;
var displaystring = resultsarray[i].string;
var tmp = /(\d\d\d\d)-(\d\d)-(\d\d)\s(\d\d):(\d\d):(\d\d)/.exec(eventtime);
var adjusteddate = new Date(tmp[1],tmp[2] - 1,tmp[3],tmp[4],tmp[5],tmp[6]);
adjusteddate.setMilliseconds(adjusteddate.getMilliseconds() + offset); //this converts the VB event time to their local time
htmlstring += "<li><a href=\"javascript:applib.showcameras(" + i + ")\">" + adjusteddate.toLocaleTimeString() + displaystring + "</a></li>"; //title=\""+resultsarray[i].string+"\"
}
window.$("#events").html(htmlstring);
window.$("#events").trigger('refresh');
window.$.mobile.changePage("#eventspage");
};
Here is the HTML string it spits out during my testing:
"<li><a href=\"javascript:applib.showcameras(0)\">9:01:18 AM security state was set to disarmed</a></li>"
And here is the HTML:
<div data-role="page" data-theme="a" id="eventspage" >
<div data-role="content">
<ul data-role="listview" id="events" data-filter="true" data-filter placeholder="Search Records...">
</ul>
</div>
Any advice is greatly appreciated! It looks like a nice list button the first time, and blue text the second time.