1

I added a progressbar when my app raise ajax application, this progress bar was prompted by a dialog, I write below code in ajaxStop function:

progressbarDialog.dialog("close");
progressbar.progressbar("close");
this.appendDOM.empty(); `

It works well when the first ajax happens, but from the second time, a dialog and progresss bar display un-normal, a blank part will show under the normal part, I think the dialog may be not deleted but hided, can anyone explain this issue? how can the dialog/progress bar total be deleted?

version 2:

progressbarDialog.dialog('destroy').remove();

do works, but my dialog is a modal dialog, when I raise application more and more time, the back-ground color will become more and more dark~~~~ below is my function, can anyone help me~

GSMProgressBar.prototype.showProgressBar = function(){ this.appendDOM.empty(); this.appendDOM.prepend("");
var progressbar = $( "#progressBarDialog #progressbar" );
var progressbarDialog = $("#progressBarDialog"); $(document).ajaxStart(function(){
var timeoutOption; if(this.config='fast'){ timeoutOption = 300; }else if(this.config='slow'){ timeoutOption = 800; }else{ //default 250 timeoutOption = 500; } progressbar.progressbar({value:false}); function progress() { var val = progressbar.progressbar( "value" ) || 0; if ( val < 75 ) { progressbar.progressbar( "value", val + Math.random() * 25 ); }
if(val<99){ setTimeout( progress, timeoutOption ); } }
setTimeout( progress, 10 ); progressbarDialog.dialog({ modal: true, height: 110, width: 400 }); $(".ui-dialog-titlebar").hide();
}); $(document).ajaxStop(function(){ progressbarDialog.dialog('destroy').remove(); }); };

4

2 回答 2

0

尝试改变:

progressbarDialog.dialog("close");

progressbarDialog.dialog('destroy').remove();

这会破坏对话框并删除包含对话框的元素

于 2013-09-09T03:28:15.127 回答
0

尝试:

$("#YOUR_PROGRESS_BAR_ID").remove();

注意:确保从 DOM 中删除后正在初始化进度条。

于 2013-09-09T03:28:52.093 回答