Ext 的Ajax 请求,添加mask 等待效果

{  
                text: "删除",  
                iconCls: "btn-del",  
                scope: this,  
                handler: function() {  
                    var f = this.centerPanel;  
                    var d = f.getSelectionModel().getSelections();  
                    if (d.length == 0) {  
                        Ext.ux.Toast.msg("信息", "请选择要删除的记录!");  
                        return;  
                    }  
                    var g = Array();  
                    for (var e = 0; e < d.length; e++) {  
                        g.push(d[e].data.dicId);  
                    }  
                    Ext.Msg.confirm("信息确认", "您确认要删除所选记录吗?",  
                    function(h) {  
                        if (h == "yes") {  
                            <span style="color:#FF6666;">Ext.getBody().mask("请稍等,正在删除中...","x-mask-loading");</span>  
                            Ext.Ajax.request({  
                                url: __ctxPath + "/system/multiDelDictionary.action",  
                                params: {  
                                    ids: g  
                                },  
                                method: "POST",  
                                success: function(i, j) {  
                                    <span style="color:#FF6666;">Ext.getBody().unmask();</span>  
                                    Ext.ux.Toast.msg("操作信息", "成功删除该数字字典!");  
                                    f.getStore().reload();  
                                },  
                                failure: function(i, j) {  
                                    <span style="color:#FF6666;">Ext.getBody().unmask();</span>  
                                    Ext.ux.Toast.msg("操作信息", "操作出错,请联系管理员!");  
                                }  
                            });  
                        }  
                    });  
                }  
            },  

方法二:(标红部分)

var myMask = new Ext.LoadMask(Ext.getBody(), {    
              msg: '正在保存,请稍后!',    
              removeMask: true //完成后移除    
});    
myMask.show(); Ext.Ajax.request({ url :
'infoPlatform/TogBuy!publish.action', waitMsg : '正在发布...', scope : this, success : function(f, o) { myMask.hide(); App.setAlert(true, "test"); }, failure : function(f, o) {   myMask.hide(); App.setAlert(false, "test"); }

转自:http://blog.csdn.net/dracotianlong/article/details/8132664

原文地址:https://www.cnblogs.com/azhqiang/p/4679315.html