changeset 255:82118c01bc52

#57: Open Edit-Dialog after creating a new Probe.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Wed, 24 Jul 2013 19:14:02 +0200
parents c2effc4a497b
children d8993f5b96e8
files app/controller/Proben.js app/view/widgets/LadaForm.js
diffstat 2 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Proben.js	Wed Jul 24 15:26:39 2013 +0200
+++ b/app/controller/Proben.js	Wed Jul 24 19:14:02 2013 +0200
@@ -74,14 +74,21 @@
         });
         console.log("Loaded Probe with ID " + record.getId()); //outputs ID
     },
-    createSuccess: function(form, record, operation) {
+    createSuccess: function(form, record, response) {
         // Reload store
-        var store = this.getProbenStore();
-        store.reload();
+        //var store = this.getProbenStore();
+        //store.reload();
         var win = form.up('window');
         win.close();
+        // Open Editdialog
+        var json = Ext.decode(response.responseText);
+        if (json) {
+            var probeId = json.data.probeId;
+            record.set('probeId', probeId);
+        }
+        this.editProbe(null, record);
     },
-    createFailure: function(form, record, operation) {
+    createFailure: function(form, record, response) {
         Ext.MessageBox.show({
             title: 'Fehler beim Speichern',
             msg: form.message,
@@ -89,14 +96,14 @@
             buttons: Ext.Msg.OK
         });
     },
-    editSuccess: function(form, record, operation) {
+    editSuccess: function(form, record, response) {
         // Reload store
         var store = this.getProbenStore();
         store.reload();
         var win = form.up('window');
         win.close();
     },
-    editFailure: function(form, record, operation) {
+    editFailure: function(form, record, response) {
         Ext.MessageBox.show({
             title: 'Fehler beim Speichern',
             msg: form.message,
--- a/app/view/widgets/LadaForm.js	Wed Jul 24 15:26:39 2013 +0200
+++ b/app/view/widgets/LadaForm.js	Wed Jul 24 19:14:02 2013 +0200
@@ -87,11 +87,11 @@
                     this.parseResponse(response);
                     if (this.success) {
                         console.log('Save was successfull');
-                        this.fireEvent('savesuccess', this);
+                        this.fireEvent('savesuccess', this, this.model, response);
                     } else {
                         console.log('Save was not successfull');
                         this.form.markInvalid(this.errors);
-                        this.fireEvent('savefailure', this);
+                        this.fireEvent('savefailure', this, this.model, response);
                     }
                 },
                 scope: this

http://lada.wald.intevation.org