1

I am having issues getting my CSS back when I append results from my database.

Here is my function:

function querySuccessOrders(tx, results) {
    console.log("Successful QUERY of the orders Table");
    var len = results.rows.length;
    console.log("orders table: " + len + " rows found.");
    for (var i=0; i<len; i++){
        $('#acceptedOrdersContent').append('<li><a href="#CompleteOrderInfo'+results.rows.item(i).OrderID+'">'+results.rows.item(i).OrderID+'</a></li>');
    }
}

The issue is that I am losing the formatting so the list item no longer links to anything (it's not clickable). I have tried to add the .page() to the end and that is not working. Can anyone show me how to add the style sheet back to the new stuff that I append from the database?

4

2 回答 2

1

如果您使用的是 jQuery 移动列表视图,则应在填充列表视图后刷新它。

可以这样做:

$('#acceptedOrdersContent').listview('refresh');

这是给你的一个例子:http: //jsfiddle.net/Gajotres/8uac7/。在此示例中,我使用 $.ajax 加载一些远程数据并在列表视图中动态显示它。填充列表视图后,我正在调用.listview('refresh'); 重新设计它。

于 2012-12-27T15:46:10.153 回答
0

尝试这个:

$('#acceptedOrdersContent').trigger('create');

那应该强制jquery-mobile应用样式。如果它仍然不起作用,请尝试在整个页面中执行此操作。

于 2012-12-27T15:41:28.833 回答