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

今天在做 Ext.Ajax.request({});的覺得需要Mask遮擋的效果

方法一 :(標紅部分)
[javascript] 

                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("操作信息", "操作出錯,請聯系管理員!"); 
                                } 
                            }); 
                        } 
                    }); 
                } 
            }, 

方法二:(標紅部分)

[javascript]
<span style="color:#FF0000;">    var myMask = new Ext.LoadMask(Ext.getBody(), {   
              msg: '正在保存,請稍後!',   
              removeMask: true //完成後移除   
          });   
          myMask.show();  </span> 
         
    Ext.Ajax.request({             
    url : 'infoPlatform/TogBuy!publish.action',   
    <span style="color:#FF0000;">waitMsg : '正在發佈…',</span>   
    scope : this,   
    success : function(f, o) {   
        <span style="color:#FF0000;">myMask.hide();  </span> 
        App.setAlert(true, "test");   
    },   
    failure : function(f, o) {   
       <span style="color:#FF0000;"> myMask.hide();  </span> 
        App.setAlert(false, "test");   
    }   

 

發佈留言