changeset 96:ecb0c0cf386b

Only add search params if the user actually set them in the form.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Fri, 14 Jun 2013 11:13:03 +0200
parents 453985cacb39
children 9a549ca6e664
files app/controller/Sql.js
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Sql.js	Thu Jun 13 14:26:37 2013 +0200
+++ b/app/controller/Sql.js	Fri Jun 14 11:13:03 2013 +0200
@@ -53,12 +53,20 @@
         // Get search parameters:
         var searchParams = {};
         if (Ext.getCmp('search').getValue() == 1) {
-            searchParams['mst'] = Ext.getCmp('mst').getValue();
-            searchParams['uwb'] = Ext.getCmp('uwb').getValue();
+            var mst = Ext.getCmp('mst').getValue();
+            var uwb = Ext.getCmp('uwb').getValue();
+            if (mst !== null) {
+                searchParams['mst'] = mst;
+            }
+            if (uwb !== null) {
+                searchParams['uwb'] = uwb;
+            }
         } else {
             // Get date object an convert it into a timestamp (ms since epoch)
             var ts = Ext.getCmp('pbegin').getValue().getTime();
-            searchParams['begin'] = ts;
+            if (ts !== null) {
+                searchParams['begin'] = ts;
+            }
         }
         result.getStore().load({
             params: searchParams

http://lada.wald.intevation.org