Mercurial > lada > lada-client
diff app/controller/grid/Status.js @ 1025:2329acae1705
Added Error handlers for Statuswerte
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Fri, 12 Feb 2016 16:33:10 +0100 |
parents | 3e9ff7786d2c |
children | 859e2e9859cd |
line wrap: on
line diff
--- 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,