diff app/controller/ProbenPlanungSwitcher.js @ 747:3ffecbce17d6

Radio-Buttons to switch between query-modes: Probenliste und Probenplanung. Filter-Combobox store wird automatisch gewechselt. ToDo: Query-Store für Probenplanung
author Dustin Demuth <dustin@intevation.de>
date Fri, 24 Apr 2015 15:47:05 +0200
parents
children 78e73be45aaa
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/controller/ProbenPlanungSwitcher.js	Fri Apr 24 15:47:05 2015 +0200
@@ -0,0 +1,56 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out
+ * the documentation coming with IMIS-Labordaten-Application for details.
+ */
+
+/**
+ * Controller for the ProbenPlanungSwitcher
+ * This controller handles all logic related to the PPS
+ */
+Ext.define('Lada.controller.ProbenPlanungSwitcher', {
+    extend: 'Ext.app.Controller',
+    displayFields: null,
+
+    /**
+     * Initialize this Controller
+     * It has 1 Listeners
+     * A checked PPS-Radiofield fired a 'check'-event
+     */
+    init: function() {
+        this.control({
+            'radiofield[name=ppswitch]': {
+                check: this.switchStores
+            }
+        });
+        this.callParent(arguments);
+    },
+
+    /**
+     * Function is called when the user selects a checkbox.
+     * according to the checkboxes inputValue,
+     * the function alters the store which was loaded by the
+     * filterpanels combobox
+     */
+    switchStores: function(field) {
+        var cbox = field.up('probenplanungswitcher').up().down('combobox');
+
+        if (field.inputValue == "probenplanung" && cbox) {
+            var sname = 'Lada.store.Queries'; // TODO change store!
+        }
+        else if (field.inputValue == "probenliste" && cbox) {
+            var sname = 'Lada.store.Queries';
+        }
+
+        var store = Ext.StoreManager.lookup(sname);
+        if (!store) {
+            store = Ext.create(sname);
+        }
+        if (store) {
+            store.load();
+            cbox.bindStore(store);
+        }
+    }
+});

http://lada.wald.intevation.org