关闭对话框时,不要再次重新打开以前的内容
我在该对话框中创建了一个对话框和一个UI选项卡。 在该对话框中,我将一些内容显示为表格。 当我通过remove()方法关闭对话框时它会关闭对话框,但是当我重新打开它时,旧内容仍然显示在选项卡中的新内容,是否存在任何方法,当对话框关闭时旧内容也会重新显示。 我用过empty()但是下面似乎无用是我的代码。
this.formOrderList = null; this.orderListDialogObject = $(''); this.orderListTable = $('' + '' + '' + '' + ' Order# ' + ' Symbol ' //+ ' Exchange ' //+ ' Market ' + ' Time ' + ' Order Type ' + ' Side ' + ' Volume ' + ' Price ' + ' Trigger Price ' + ' Filled Volume ' + ' Status ' + ' Expiry Date ' + ' Ref # ' + ' Action ' + ' ' + '' + '' + '' + '
' + ''); this.orderListTabs = $('' + '' + '- Pending
' + '
' + '' + '' + ''); 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);
我不完全理解,但如果你需要删除表,那么你可能只是删除它
//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"); } });