[Lada-commits] [PATCH 1 of 2] Added logic to autofill the Netzbetreiber when the Messstelle was selected

Wald Commits scm-commit at wald.intevation.org
Tue Jul 7 09:57:48 CEST 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1436255737 -7200
# Node ID beef4e8eeafcc2e93d1157ebbb0323d65f012e47
# Parent  cf35c63053701abee520c0c11d8a72272f580bc0
Added logic to autofill the Netzbetreiber when the Messstelle was selected.

diff -r cf35c6305370 -r beef4e8eeafc app/controller/form/Messprogramm.js
--- a/app/controller/form/Messprogramm.js	Tue Jul 07 09:37:34 2015 +0200
+++ b/app/controller/form/Messprogramm.js	Tue Jul 07 09:55:37 2015 +0200
@@ -35,7 +35,8 @@
             },
             'messprogrammform messstelle combobox':{
                 expand: this.filter,
-                keydown: this.filter
+                keydown: this.filter,
+                select: this.setNetzbetreiber
             },
             'messprogrammform location combobox': {
                 select: this.syncOrtWindow
@@ -78,6 +79,25 @@
     },
 
     /**
+     * When a Messtelle is selected, modify the Netzbetreiber
+     * according to the Messstelle
+     * TODO: The conditions when to apply this automatism are still
+     *   unclear. Right now it is only applied when the NB is not set.
+     */
+    setNetzbetreiber: function(combo, records){
+        var netzbetreiber = combo.up().up('form')
+                .down('netzbetreiber').down('combobox');
+        var nbId = records[0].get('netzbetreiberId');
+
+        debugger;
+        if (nbId != null &&
+               (netzbetreiber.value === '' || netzbetreiber.value === null)) {
+            //select the NB in the NB-Combobox
+            netzbetreiber.select(nbId);
+        }
+    },
+
+    /**
      * When the Probenintervall was changed, update the Sliders
      * and the the numberfield.
      */


More information about the Lada-commits mailing list