Pman.Gnumeric.js
[Pman.Core] / Pman.Request.js
index 36fd4b0..b4db0f0 100644 (file)
@@ -25,6 +25,7 @@ var t = new Pman.Request({
 *       request, a url encoded string or a function to call to get either.
 * @cfg  {Function} success  called with ( JSON decoded data of the data.. )
 * @cfg  {Function} success  called with ( JSON decoded data of the data.. )
+* @cfg {Boolean} showFailureDialog (true|false) default true
 */
 
 Pman.Request = function(config){
@@ -42,6 +43,8 @@ Pman.Request = function(config){
 
 Roo.extend(Pman.Request, Roo.data.Connection, {
     // private
+    showFailureDialog : true,
+    
     processResponse : function(response) {
         // convert the Roo Connection response into JSON data.
         
@@ -71,13 +74,11 @@ Roo.extend(Pman.Request, Roo.data.Connection, {
         this.transId = false;
         var options = response.argument.options;
         response.argument = options ? options.argument : null;
+        this.fireEvent("requestcomplete", this, response, options);
         
         if (this.mask && this.maskEl) {
             Roo.get(this.maskEl).unmask(true);
         }
-        
-        this.fireEvent("requestcomplete", this, response, options);
-        
         var res = this.processResponse(response);
                 
         if (!res.success) { // error!
@@ -97,22 +98,25 @@ Roo.extend(Pman.Request, Roo.data.Connection, {
         this.transId = false;
         var options = response.argument.options;
         response.argument = options ? options.argument : null;
-        
+        this.fireEvent("requestexception", this, response, options, e);
+        var res = Roo.callback(options.failure, options.scope, [response, options]);
         if (this.mask && this.maskEl) {
             Roo.get(this.maskEl).unmask(true);
         }
-        
-        this.fireEvent("requestexception", this, response, options, e);
-        var res = Roo.callback(options.failure, options.scope, [response, options]);
-        
+        if(!this.showFailureDialog){
+            return;
+        }
         if (res !== true) {
             var decode = this.processResponse(response);
             Roo.log(decode);
+            
             if (Roo.MessageBox.isVisible()) {
                 alert(decode && decode.errorMsg ?  decode.errorMsg : "Error Sending data - return true from failure to remove message");
                 return;
-            }            
+            }
+            
             Roo.MessageBox.alert("Error", decode && decode.errorMsg ?  decode.errorMsg : "Error Sending data");
+            
         }
     }
-});
\ No newline at end of file
+});