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: 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'); dustin@747: dustin@747: if (field.inputValue == "probenplanung" && cbox) { dustin@747: var sname = 'Lada.store.Queries'; // TODO change store! dustin@747: } dustin@747: else if (field.inputValue == "probenliste" && cbox) { dustin@747: var sname = 'Lada.store.Queries'; 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@747: cbox.bindStore(store); dustin@747: } dustin@747: } dustin@747: });