changeset 697:5b2cbc6bc39a

Display Error Message on Failure
author Dustin Demuth <dustin@intevation.de>
date Thu, 26 Mar 2015 17:23:13 +0100
parents b0f1dcdf981d
children 9635f4e60b13
files app/controller/grid/MKommentar.js app/controller/grid/Probenzusatzwert.js
diffstat 2 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/grid/MKommentar.js	Thu Mar 26 16:26:24 2015 +0100
+++ b/app/controller/grid/MKommentar.js	Thu Mar 26 17:23:13 2015 +0100
@@ -26,12 +26,19 @@
 
     edit: function(editor, context) {
         context.record.save({
-            success: function() {
+            success: function(record, response) {
                 context.grid.initData();
                 context.grid.up('window').initData();
             },
-            failure: function() {
-                // TODO
+            failure: function(record, response) {
+              var json = response.request.scope.reader.jsonData;
+              if (json) {
+                if (json.message){
+                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('errmsgtitle')
+                        +' '+json.message,
+                        Lada.getApplication().bundle.getMsg(json.message));
+                    }
+                }
             }
         });
     },
--- a/app/controller/grid/Probenzusatzwert.js	Thu Mar 26 16:26:24 2015 +0100
+++ b/app/controller/grid/Probenzusatzwert.js	Thu Mar 26 17:23:13 2015 +0100
@@ -30,8 +30,17 @@
                 context.grid.store.reload();
                 context.grid.up('window').initData();
             },
-            failure: function() {
-                // TODO
+            failure: function(record, response) {
+                console.log(response);
+                console.log(record);
+                var json = response.request.scope.reader.jsonData;
+                if (json) {
+                    if (json.message){
+                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('errmsgtitle')
+                            +' '+json.message,
+                            Lada.getApplication().bundle.getMsg(json.message));
+                    }
+                }
             }
         });
     },

http://lada.wald.intevation.org