diff app/controller/FilterManagement.js @ 1015:af9879d72310

Updated UI, added window for filter management and added fieldset for query details.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 02 Feb 2016 15:25:16 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/controller/FilterManagement.js	Tue Feb 02 15:25:16 2016 +0100
@@ -0,0 +1,61 @@
+/* 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.
+ */
+
+/**
+ *
+ */
+Ext.define('Lada.controller.FilterManagement', {
+    extend: 'Ext.app.Controller',
+
+    /**
+     * @private
+     * Initialize the controller.
+     */
+    init: function() {
+        var me = this;
+        this.control({
+            'filtermanagement grid favcolumn': {
+                checkchange: me.checkchange
+            },
+            'filtermanagement': {
+                close: me.windowClosed
+            }
+        });
+    },
+
+    checkchange: function(column, ndx, value) {
+        var store = column.up('grid').store;
+        var record = store.getAt(ndx);
+        if (value) {
+            Ext.Ajax.request({
+                url: 'lada-server/rest/favorite',
+                method: 'POST',
+                jsonData: {
+                    'queryId': record.get('id')
+                },
+                success: function() {
+                    record.set('favorite', true);
+                }
+            });
+        }
+        else {
+            Ext.Ajax.request({
+                url: 'lada-server/rest/favorite?queryId=' + record.get('id'),
+                method: 'DELETE',
+                success: function() {
+                    record.set('favorite', false);
+                }
+            });
+        }
+    },
+
+    windowClosed: function() {
+        var combobox = Ext.ComponentQuery.query('combobox[name=filter]')[0];
+        this.getController('Lada.controller.Filter').updateFilter(combobox);
+    }
+});

http://lada.wald.intevation.org