changeset 36:2a67e062519b

Implemted search. When user clicks on the search buttons parameters are fetched and a query url is the generated.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Thu, 23 May 2013 16:50:42 +0200
parents 3f801444b8d5
children e9229d79e430
files app/controller/Sql.js app/store/Proben.js
diffstat 2 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Sql.js	Thu May 23 16:09:05 2013 +0200
+++ b/app/controller/Sql.js	Thu May 23 16:50:42 2013 +0200
@@ -49,7 +49,20 @@
     search: function(element, record, index) {
         var result = Ext.getCmp('result');
         console.log('Loading store');
-        result.getStore().load();
+
+        // Get search parameters:
+        var searchParams = {};
+        if (Ext.getCmp('search').getValue() == 1) {
+            searchParams['mst'] = Ext.getCmp('mst').getValue();
+            searchParams['uwb'] = Ext.getCmp('uwb').getValue();
+        } else {
+            // Get date object an convert it into a timestamp (ms since epoch)
+            var ts = Ext.getCmp('pbegin').getValue().getTime();
+            searchParams['begin'] = ts;
+        }
+        result.getStore().load({
+            params: searchParams
+        });
         console.log('Store loaded');
         result.show();
     },
--- a/app/store/Proben.js	Thu May 23 16:09:05 2013 +0200
+++ b/app/store/Proben.js	Thu May 23 16:50:42 2013 +0200
@@ -3,8 +3,8 @@
     model: 'Lada.model.Probe',
     proxy: {
         type: 'ajax',
+        url: 'server/rest/proben',
         api: {
-        read: 'server/rest/proben'
         },
         reader: {
             type: 'json'

http://lada.wald.intevation.org