在关闭对话框时,不要在再次打开时删除先前的内容 [英] on closing dialog do not remove the previous contents on re-opening again
本文介绍了在关闭对话框时,不要在再次打开时删除先前的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个对话框,并在该对话框中创建了一个UI选项卡.在该对话框中,我将一些内容显示为表格.当我通过remove()方法关闭对话框时,它会关闭对话框,但是当我重新打开对话框时,旧内容仍会在选项卡中显示新内容,是否有任何方法在对话框关闭时也会删除旧内容.我用过empty(),但是下面的代码似乎没用.
I have made a dialog and a UI Tab in that dialog. In that dialog i am showing some contents as a table. When i close the dialog by remove() method it closes the dialog but when i reopen it, the old contents are still showing with the new contents in the tab, is there any method that old contents will also reomve when dialog closes. I have used empty() but it seems useless below is my code.
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);
推荐答案
我不完全了解,但是如果您需要删除表,那么您可以将其删除
I don't understand fully, but if you need to remove the table, well you might just remove it
//Save a reference of the dialog
var myDialog = this.orderListDialogObject.dialog({
title : 'Order List',
width : 850,
height : 150,
close : function(ev, ui) {
//remove the table
$('table#orderListTable').remove();
//close the dialog destroing it
myDialog.dialog("close");
}
});
这篇关于在关闭对话框时,不要在再次打开时删除先前的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文