dustin@747: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz dustin@747: * Software engineering by Intevation GmbH dustin@747: * dustin@747: * This file is Free Software under the GNU GPL (v>=3) dustin@747: * and comes with ABSOLUTELY NO WARRANTY! Check out dustin@747: * the documentation coming with IMIS-Labordaten-Application for details. dustin@747: */ dustin@747: dustin@747: /** dustin@747: * Controller for the ProbenPlanungSwitcher dustin@747: * This controller handles all logic related to the PPS dustin@747: */ dustin@747: Ext.define('Lada.controller.ProbenPlanungSwitcher', { dustin@747: extend: 'Ext.app.Controller', dustin@747: displayFields: null, dustin@747: raimund@749: requires: [ raimund@749: 'Lada.store.MessprogrammQueries' raimund@749: ], raimund@749: dustin@747: /** dustin@747: * Initialize this Controller dustin@747: * It has 1 Listeners dustin@747: * A checked PPS-Radiofield fired a 'check'-event dustin@747: */ dustin@747: init: function() { dustin@747: this.control({ dustin@747: 'radiofield[name=ppswitch]': { dustin@747: check: this.switchStores dustin@747: } dustin@747: }); dustin@747: this.callParent(arguments); dustin@747: }, dustin@747: dustin@747: /** dustin@747: * Function is called when the user selects a checkbox. dustin@747: * according to the checkboxes inputValue, dustin@747: * the function alters the store which was loaded by the dustin@747: * filterpanels combobox dustin@747: */ dustin@747: switchStores: function(field) { dustin@747: var cbox = field.up('probenplanungswitcher').up().down('combobox'); raimund@749: var resultGrid = field.up('panel[name=main]').down('filterresultgrid'); dustin@752: filters = field.up('panel[name=main]').down('fieldset[name=filtervariables]'); dustin@752: filters.removeAll(); dustin@752: filters.hide(); raimund@749: var sname = 'Lada.store.ProbeQueries'; dustin@751: if (field.inputValue === 'MessprogrammeList' && cbox) { dustin@750: sname = 'Lada.store.MessprogrammQueries'; dustin@747: } dustin@751: else if (field.inputValue === 'ProbenList' && cbox) { raimund@749: sname = 'Lada.store.ProbeQueries'; dustin@747: } dustin@747: dustin@747: var store = Ext.StoreManager.lookup(sname); dustin@747: if (!store) { dustin@747: store = Ext.create(sname); dustin@747: } dustin@747: if (store) { dustin@747: store.load(); dustin@750: cbox.reset(); dustin@747: cbox.bindStore(store); dustin@747: } dustin@747: } dustin@747: });