[Lada-commits] [PATCH] Added a possible fix for issue57. After the create dialog is closed the edit

Wald Commits scm-commit at wald.intevation.org
Thu Jul 25 09:28:20 CEST 2013


# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1374737203 -7200
# Node ID d8993f5b96e8b3b11a6d64d68f782841def2619d
# Parent  82118c01bc5212acac5ae57ec86728d39ac0061c
Added a possible fix for issue57. After the create dialog is closed the edit
window is opened.

diff -r 82118c01bc52 -r d8993f5b96e8 app/controller/Proben.js
--- a/app/controller/Proben.js	Wed Jul 24 19:14:02 2013 +0200
+++ b/app/controller/Proben.js	Thu Jul 25 09:26:43 2013 +0200
@@ -75,18 +75,24 @@
         console.log("Loaded Probe with ID " + record.getId()); //outputs ID
     },
     createSuccess: function(form, record, response) {
-        // Reload store
-        //var store = this.getProbenStore();
-        //store.reload();
+        // Close Createdialog
         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);
+        // Reload store
+        var store = this.getProbenStore();
+        store.reload({
+            scope: this,
+            callback: function(records, operation, success) {
+                console.log('Reloaded store');
+                // Open Editdialog
+                var json = Ext.decode(response.responseText);
+                if (json) {
+                    var probeId = json.data.probeId;
+                    var probe = store.findRecord("probeId", probeId);
+                    this.editProbe(null, probe);
+                }
+            }
+        });
     },
     createFailure: function(form, record, response) {
         Ext.MessageBox.show({


More information about the Lada-commits mailing list