diff app/controller/form/Probe.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 dd6925ef6028
children e25fcc9269df
line wrap: on
line diff
--- a/app/controller/form/Probe.js	Wed May 20 16:48:03 2015 +0200
+++ b/app/controller/form/Probe.js	Thu May 21 15:23:49 2015 +0200
@@ -27,6 +27,10 @@
             'probeform': {
                 dirtychange: this.dirtyForm
             },
+            'probeform messstelle combobox':{
+                expand: this.filter,
+                keydown: this.filter
+            },
             'probeform [xtype="datetime"] field': {
                 blur: this.checkDate
             },
@@ -37,6 +41,23 @@
     },
 
     /**
+     * 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);
+    },
+
+    /**
      * The save function saves the content of the Location form.
      * On success it will reload the Store,
      * on failure, it will display an Errormessage

http://lada.wald.intevation.org