Mercurial > lada > lada-client
changeset 1319:518b4c28e71a
Ortserstellung does no longer update existing Orte
author | Maximilian Krambach <mkrambach@intevation.de> |
---|---|
date | Fri, 03 Feb 2017 14:25:38 +0100 |
parents | cc90b8050887 |
children | 754db8d73691 |
files | app/view/form/Ortserstellung.js |
diffstat | 1 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/app/view/form/Ortserstellung.js Fri Feb 03 13:18:12 2017 +0100 +++ b/app/view/form/Ortserstellung.js Fri Feb 03 14:25:38 2017 +0100 @@ -272,17 +272,25 @@ saveOrt: function() { var this_panel = this.up('panel'); + var me = this; var form = this_panel.getForm(); var record = form.getRecord(); - var oldId = record.get('ortId'); var data = form.getFieldValues(true); for (var key in data) { record.set(key, data[key]); } + record.set('id', null); record.set('netzbetreiberId', Lada.netzbetreiber[0]); record.save({ success: function(newrecord, response) { form.loadRecord(newrecord); + this_panel.down('verwaltungseinheit').store.load( + { id:newrecord.get('gemId') }); + console.log(this_panel.down('verwaltungseinheit')); + this_panel.down('staat').store.load( + { id : newrecord.get('staat') }); + me.setDisabled(true); + me.hide(); var ozw = this_panel.up().parentWindow; var json = Ext.decode(response.response.responseText); if (json) { @@ -304,11 +312,7 @@ resulttext = 'Dieser Ort existiert bereits!'; } if (json.message == '200') { - if (oldId === undefined) { - resulttext = 'Ort erfolgreich angelegt!'; - } else { - resulttext = 'Bestehender Ort erfolgreich modifiziert!'; - } + resulttext = 'Ort erfolgreich angelegt!'; } } Ext.Msg.show({ @@ -340,6 +344,7 @@ Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), Lada.getApplication().bundle.getMsg('err.msg.response.body')); } + me.setDisabled(true); } }); },