ext動態進度條
阿新 • • 發佈:2019-01-25
定時查詢更新進度條,如果具體的修改狀態操作可以在另一個ajax請求裡寫
var task = { interval: 10000, //每10秒更新 run: function () { var msgBox = Ext.MessageBox.show({ title: '下發進度', msg: '正在下發!', progress: true, width: 400, buttons: Ext.Msg.OK, scope: document.body }); Ext.Ajax.request({ url: 'Door/getSendCount', params: {}, disableCaching: true,//禁止快取 timeout: 30000,//最大等待時間,超出則會觸發超時 method: "GET", success: function (response, opts) { var ret = Ext.JSON.decode(response.responseText); //JSON物件化 var total = ret.total; var count = ret.count; if (count != total) { //計算進度 var percentage = count / total;//顯示內容 var processText = '下發數量:' + total + ';已完成數量' + count + '; '; //更新進度條; msgBox.updateProgress(percentage, processText, '下發進度'); } else { msgBox.hide(); Ext.TaskManager.stop(task); win.show(); } }, failure: function (response, opts) { } });} } Ext.TaskManager.start(task);