[Lada-commits] [PATCH] Set ortId in l_ort if new ortdetail was created

Wald Commits scm-commit at wald.intevation.org
Tue Jul 2 15:48:38 CEST 2013


# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1372772865 -7200
# Node ID 5414e611097ecf41be91ed43b460376aa3e6407c
# Parent  16ba7e2465fddf8fbec4cb605d57853d2cd0bb29
Set ortId in l_ort if new ortdetail was created.

diff -r 16ba7e2465fd -r 5414e611097e app/controller/Orte.js
--- 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();
             },


More information about the Lada-commits mailing list