为什么当我运行我的代码时显示重复的内容?我使用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