comparison app/controller/Filter.js @ 751:704bb359c0fe

dynamically exchange the store of the resultfiltergrid
author Dustin Demuth <dustin@intevation.de>
date Tue, 28 Apr 2015 16:03:59 +0200
parents 6e28ebbe1a73
children 639e82e2089e
comparison
equal deleted inserted replaced
750:561ade69980e 751:704bb359c0fe
186 * Function is called when the user clicks the search button. The function 186 * Function is called when the user clicks the search button. The function
187 * will perform a search to the server on refreshes the result list. 187 * will perform a search to the server on refreshes the result list.
188 */ 188 */
189 search: function(element) { 189 search: function(element) {
190 var resultGrid = element.up('panel[name=main]').down('filterresultgrid'); 190 var resultGrid = element.up('panel[name=main]').down('filterresultgrid');
191 resultGrid.setupColumns(this.displayFields);
192 var filters = element.up('panel[name=main]').down('fieldset[name=filtervariables]'); 191 var filters = element.up('panel[name=main]').down('fieldset[name=filtervariables]');
193 var search = element.up('fieldset').down('combobox[name=filter]'); 192 var search = element.up('fieldset').down('combobox[name=filter]');
194 193
195 // Get search parameters: 194 // Get search parameters:
196 var searchParams = {}; 195 var searchParams = {};
201 if (value instanceof Array) { 200 if (value instanceof Array) {
202 value = value.join(','); 201 value = value.join(',');
203 } 202 }
204 searchParams[filter.getName()] = value; 203 searchParams[filter.getName()] = value;
205 } 204 }
206 resultGrid.getStore().proxy.extraParams = searchParams; 205 // Retrieve the mode
207 resultGrid.getStore().load(); 206 var modes = element.up('panel[name=main]').down('probenplanungswitcher').getChecked();
208 resultGrid.show(); 207 var sname = modes[0].inputValue;
208
209 if (sname === 'ProbenList') {
210 sname = 'Lada.store.ProbenList';
211 }
212 else if (sname === 'MessprogrammeList') {
213 sname = 'Lada.store.MessprogrammeList';
214 }
215
216 // Find the store or create a new one.
217 var store = Ext.StoreManager.lookup(sname);
218 if (!store) {
219 store = Ext.create(sname);
220 }
221 if (store) {
222 resultGrid.setStore(store);
223 resultGrid.setupColumns(this.displayFields);
224 resultGrid.getStore().proxy.extraParams = searchParams;
225 resultGrid.getStore().load();
226 resultGrid.show();
227 }
209 }, 228 },
210 /** 229 /**
211 * This function resets the filters 230 * This function resets the filters
212 */ 231 */
213 reset: function(element) { 232 reset: function(element) {

http://lada.wald.intevation.org