diff app/controller/Proben.js @ 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 237a4efe715a
children d8993f5b96e8
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,

http://lada.wald.intevation.org