Mercurial > lada > lada-client
diff 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 |
line wrap: on
line diff
--- a/app/controller/Filter.js Tue Apr 28 11:53:39 2015 +0200 +++ b/app/controller/Filter.js Tue Apr 28 16:03:59 2015 +0200 @@ -188,7 +188,6 @@ */ search: function(element) { var resultGrid = element.up('panel[name=main]').down('filterresultgrid'); - resultGrid.setupColumns(this.displayFields); var filters = element.up('panel[name=main]').down('fieldset[name=filtervariables]'); var search = element.up('fieldset').down('combobox[name=filter]'); @@ -203,9 +202,29 @@ } searchParams[filter.getName()] = value; } - resultGrid.getStore().proxy.extraParams = searchParams; - resultGrid.getStore().load(); - resultGrid.show(); + // Retrieve the mode + var modes = element.up('panel[name=main]').down('probenplanungswitcher').getChecked(); + var sname = modes[0].inputValue; + + if (sname === 'ProbenList') { + sname = 'Lada.store.ProbenList'; + } + else if (sname === 'MessprogrammeList') { + sname = 'Lada.store.MessprogrammeList'; + } + + // Find the store or create a new one. + var store = Ext.StoreManager.lookup(sname); + if (!store) { + store = Ext.create(sname); + } + if (store) { + resultGrid.setStore(store); + resultGrid.setupColumns(this.displayFields); + resultGrid.getStore().proxy.extraParams = searchParams; + resultGrid.getStore().load(); + resultGrid.show(); + } }, /** * This function resets the filters