爲什麼當我運行我的代碼時顯示重複的內容?我使用empty()來刪除重新運行的以前的記錄,但它似乎並沒有工作。重複記錄顯示
這裏是我的代碼:
function listClass() {
this.formOrderList = null;
this.orderListDialogObject = $('<div id="mainDiv"></div>');
this.orderListTable = $('<div>'
+ '<table id="orderListTable" class="ui-widget tblBorder" width="100%" border="0" cellspacing="1" cellpadding="2">'
+ '<thead class="ui-widget-header" id="orderListHead">' + '<tr>'
+ '<th><strong> Order# </strong></th>'
+ '<th><strong> Symbol </strong></th>'
//+ '<th><strong> Exchange </strong></th>'
//+ '<th><strong> Market </strong></th>'
+ '<th><strong> Time </strong></th>'
+ '<th><strong> Order Type </strong></th>'
+ '<th><strong> Side </strong></th>'
+ '<th><strong> Volume </strong></th>'
+ '<th><strong> Price </strong></th>'
+ '<th><strong> Trigger Price </strong></th>'
+ '<th><strong> Filled Volume </strong></th>'
+ '<th><strong> Status </strong></th>'
+ '<th><strong> Expiry Date </strong></th>'
+ '<th><strong> Ref # </strong></th>'
+ '<th><strong> Action </strong></th>' + '</tr>' + '</thead>'
+ '<tbody id="orderListBody">' + '</tbody>' + '</table>' + '</div>');
this.orderListTabs = $('<div>' + '<ul>'
+ '<li><a href="#pendingOrderList">Pending</a></li>' + '</ul>'
+ '<div id="pendingOrderList">' + '</div>' + '</div>');
this.orderListDialogObject.appendTo("body");
this.show = function() {
$("#orderListBody", this.orderListTable).empty();
this.orderListDialogObject.dialog({
title : 'Order List',
width : 850,
height : 150,
close : function(ev, ui) {
$(this).remove();
return false;
/*$(this).dialog('destroy').remove();
return false;*/
}
});
this.orderListTabs.tabs();
this.orderListTabs.appendTo(this.orderListDialogObject);
$("#pendingOrderList", this.orderListTabs).append(this.orderListTable);
}
我已經建立[示例](http://jsfiddle.net/pnNNU/)與您的代碼,但不能[見(HTTP://的jsfiddle .net/pnNNU/show /)重複的內容。 – scessor 2012-02-07 07:25:45
scessor不在thead中,它顯示重複的內容。 – 2012-02-07 07:36:59
哪些函數填充'tbody'?在[這個例子](http://jsfiddle.net/pnNNU/1/show/)([在這裏用代碼](http://jsfiddle.net/pnNNU/1/))你看到一個例子充滿'tbody '和重複的內容沒有問題。 – scessor 2012-02-07 07:52:01