Mercurial > lada > lada-client
diff app/controller/Sql.js @ 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 | ecb0c0cf386b |
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(); },