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@792: check: this.switchModes 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@792: * filterpanels combobox, dustin@792: * If enabled the function also disables / enables the UI-Buttons dustin@792: * in the Filterresult grid. dustin@747: */ dustin@792: switchModes: function(field) { dustin@792: dustin@792: var disableButtons = true; dustin@792: 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@792: if (field.inputValue === 'MessprogrammList' && cbox) { dustin@750: sname = 'Lada.store.MessprogrammQueries'; dustin@747: } dustin@792: else if (field.inputValue === 'ProbeList' && cbox) { raimund@749: sname = 'Lada.store.ProbeQueries'; dustin@747: } dustin@747: dustin@792: dustin@747: var store = Ext.StoreManager.lookup(sname); dustin@747: if (!store) { dustin@794: store = Ext.create(sname, { dustin@794: //Select first Item on Load dustin@794: listeners: { dustin@794: load: function(s){ dustin@795: var records = new Array(); dustin@795: records.push(store.getAt(0)); dustin@795: dustin@795: cbox.select(records[0]); dustin@795: cbox.fireEvent('select', cbox, records); dustin@794: } dustin@794: } dustin@794: }); 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: });