Mercurial > lada > lada-client
comparison app/controller/Sql.js @ 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 | 2a67e062519b |
children | 9a549ca6e664 |
comparison
equal
deleted
inserted
replaced
95:453985cacb39 | 96:ecb0c0cf386b |
---|---|
51 console.log('Loading store'); | 51 console.log('Loading store'); |
52 | 52 |
53 // Get search parameters: | 53 // Get search parameters: |
54 var searchParams = {}; | 54 var searchParams = {}; |
55 if (Ext.getCmp('search').getValue() == 1) { | 55 if (Ext.getCmp('search').getValue() == 1) { |
56 searchParams['mst'] = Ext.getCmp('mst').getValue(); | 56 var mst = Ext.getCmp('mst').getValue(); |
57 searchParams['uwb'] = Ext.getCmp('uwb').getValue(); | 57 var uwb = Ext.getCmp('uwb').getValue(); |
58 if (mst !== null) { | |
59 searchParams['mst'] = mst; | |
60 } | |
61 if (uwb !== null) { | |
62 searchParams['uwb'] = uwb; | |
63 } | |
58 } else { | 64 } else { |
59 // Get date object an convert it into a timestamp (ms since epoch) | 65 // Get date object an convert it into a timestamp (ms since epoch) |
60 var ts = Ext.getCmp('pbegin').getValue().getTime(); | 66 var ts = Ext.getCmp('pbegin').getValue().getTime(); |
61 searchParams['begin'] = ts; | 67 if (ts !== null) { |
68 searchParams['begin'] = ts; | |
69 } | |
62 } | 70 } |
63 result.getStore().load({ | 71 result.getStore().load({ |
64 params: searchParams | 72 params: searchParams |
65 }); | 73 }); |
66 console.log('Store loaded'); | 74 console.log('Store loaded'); |