changeset 155:5414e611097e

Set ortId in l_ort if new ortdetail was created.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 02 Jul 2013 15:47:45 +0200
parents 16ba7e2465fd
children dcb40a53ade2
files app/controller/Orte.js
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Orte.js	Tue Jul 02 15:28:41 2013 +0200
+++ b/app/controller/Orte.js	Tue Jul 02 15:47:45 2013 +0200
@@ -47,7 +47,7 @@
 
         var ortdetail = null;
         var ortdetailstore = Ext.getStore('Ortedetails');
-        var newortdetail = true;
+        var newortdetail = false;
 
         var ortid = fform.findField('ortId').getValue();
         if (ortid === null) {
@@ -68,11 +68,11 @@
         }
         // Create a new Ortedetail if nessecary
         ortdetailstore.sync({
-            success: function() {
+            success: function(batch, options) {
                 if (newortdetail) {
-                    // TODO: Get ID from new created ortdetail and set it to the ort
-                    ortid = 1;
-                    form.model.set('ortId', ortid);
+                    // Get ID from new created ortdetail and set it to the ort
+                    var response = options.operations.update[0].store.proxy.reader.jsonData;
+                    form.model.set('ortId', response.ortId);
                 }
                 form.commit();
             },

http://lada.wald.intevation.org