[Lada-commits] [PATCH 1 of 2] Added Error handlers for Statuswerte

Wald Commits scm-commit at wald.intevation.org
Fri Feb 12 16:34:38 CET 2016


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1455291190 -3600
# Node ID 2329acae170520005c705bdfcc3723c75417d0a6
# Parent  3e9ff7786d2c38d4be1dbdaedefe40c11386dc2c
Added Error handlers for Statuswerte

diff -r 3e9ff7786d2c -r 2329acae1705 app/controller/grid/Status.js
--- a/app/controller/grid/Status.js	Tue Feb 09 09:48:57 2016 +0100
+++ b/app/controller/grid/Status.js	Fri Feb 12 16:33:10 2016 +0100
@@ -41,7 +41,26 @@
      gridSave: function(editor, context) {
         context.record.set('sdatum', new Date());
         context.record.save({
-            success: function() {
+            success: function(response) {
+                var i18n = Lada.getApplication().bundle;
+                var json = Ext.JSON.decode(response.responseText);
+
+                if(json) {
+                    if (!json.success) {
+                        if(json.message){
+                            Ext.Msg.alert(i18n.getMsg('err.msg.generic.title')
+                                +' #'+json.message,
+                                i18n.getMsg(json.message));
+                        } else {
+                            Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'),
+                                i18n.getMsg('err.msg.generic.body'));
+                        }
+                    } else {
+                        Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'),
+                        i18n.getMsg('err.msg.generic.body'));
+                    }
+                }
+
                 context.grid.initData();
                 var win = context.grid.up('window');
                 win.initData();
@@ -170,6 +189,22 @@
             jsonData: record.getData(),
             method: 'POST',
             success: function(response) {
+                var i18n = Lada.getApplication().bundle;
+                var json = Ext.JSON.decode(response.responseText);
+
+                if(json) {
+                    if (!json.success) {
+                        if(json.message){
+                            Ext.Msg.alert(i18n.getMsg('err.msg.generic.title')
+                                +' #'+json.message,
+                                i18n.getMsg(json.message));
+                        } else {
+                            Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'),
+                                i18n.getMsg('err.msg.generic.body'));
+                        }
+                    }
+                }
+
                 button.up('window').initData();
                 button.up('grid').initData();
             },
@@ -178,9 +213,6 @@
                 var i18n = Lada.getApplication().bundle;
                 var json = Ext.JSON.decode(response.responseText);
                 if (json) {
-                    if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
-                        formPanel.setMessages(json.errors, json.warnings);
-                    }
                     if(json.message){
                         Ext.Msg.alert(i18n.getMsg('err.msg.generic.title')
                             +' #'+json.message,


More information about the Lada-commits mailing list