日期:2014-05-16  浏览次数:20681 次

【转】Ext.Ajax.Request加上Mask
var saveGrid = function() {   
  
        var editDs = user_store.getModifiedRecords();   
        var myMask = new Ext.LoadMask(Ext.getBody(), {   
                    msg : "Please wait..."  
                });   
  
        for (var index = 0; index < editDs.length; index++) {   
            record = editDs[index];   
  
            // alert(Ext.util.JSON.encode(record.data));   
            myMask.show();   
            Ext.Ajax.request({   
                url : 'UpdateUsers.json',   
                success : function someFn(result, request)   
  
                {   
                    myMask.hide();   
                    // alert('保存成功');   
                    user_store.commitChanges();   
  
                },   
                failure : function otherFn(result, request)   
  
                {   
                    myMask.hide();   
                    this.showError(result.error || result.responseText);   
  
                },   
                method : 'POST',   
                params : {   
                    user : Ext.util.JSON.encode(record.data)   
                }   
            });   
        }   
  
        myMask.destroy();   
    } // eof saveGrid