diff app/controller/form/Messprogramm.js @ 798:ff4330d4aba1

Filter Messtellen in Probeform and Messprogramm
author Dustin Demuth <dustin@intevation.de>
date Thu, 21 May 2015 15:23:49 +0200
parents b8fd43021c29
children c135201940ee
line wrap: on
line diff
--- a/app/controller/form/Messprogramm.js	Wed May 20 16:48:03 2015 +0200
+++ b/app/controller/form/Messprogramm.js	Thu May 21 15:23:49 2015 +0200
@@ -33,6 +33,10 @@
             'messprogrammform': {
                 dirtychange: this.dirtyForm
             },
+            'messprogrammform messstelle combobox':{
+                expand: this.filter,
+                keydown: this.filter
+            },
             'messprogrammform location combobox': {
                 select: this.syncOrtWindow
             },
@@ -55,6 +59,24 @@
             }
         });
     },
+
+    /**
+     * The Messtellen Store contains ALL Messtellen.
+     * Filter the store in this combobox to reduce the choices
+     * to the subset which the user is allowed to use.
+     */
+    filter: function(field) {
+        var fil =  Ext.create('Ext.util.Filter', {
+            filterFn: function(item) {
+                if (Ext.Array.contains(Lada.mst, item.get('id'))) {
+                    return true;
+                }
+                return false;
+            }
+        });
+        field.getStore().filter(fil);
+    },
+
     /**
      * When the Probenintervall was changed, update the Sliders
      * and the the numberfield.

http://lada.wald.intevation.org