dustin@566: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz dustin@566: * Software engineering by Intevation GmbH dustin@566: * dustin@566: * This file is Free Software under the GNU GPL (v>=3) dustin@566: * and comes with ABSOLUTELY NO WARRANTY! Check out dustin@566: * the documentation coming with IMIS-Labordaten-Application for details. dustin@566: */ dustin@566: dustin@566: /* dustin@566: * Controller for a Messungengrid dustin@566: */ dustin@566: Ext.define('Lada.controller.MessungenGrid', { dustin@566: extend: 'Ext.app.Controller', dustin@566: dustin@577: requires: [ dustin@577: 'Lada.view.window.MessungEdit' dustin@577: ], dustin@577: dustin@566: init: function() { dustin@566: this.control({ dustin@566: 'messungengrid': { dustin@577: itemdblclick: this.open dustin@566: }, dustin@566: 'messungengrid button[action=add]': { dustin@566: click: this.add dustin@566: }, dustin@566: 'messungengrid button[action=delete]': { dustin@566: click: this.remove dustin@566: } dustin@566: }); dustin@566: }, dustin@566: dustin@577: open: function(grid, record) { dustin@577: //Opens a detailed view of the Messung dustin@577: var win = Ext.create('Lada.view.window.MessungEdit', { raimund@585: record: record dustin@577: }); dustin@577: win.show(); dustin@577: win.initData(); dustin@566: }, dustin@566: dustin@566: add: function() { raimund@585: // TODO dustin@566: console.log('add'); dustin@566: }, dustin@566: dustin@566: remove: function(button) { dustin@566: var grid = button.up('grid'); dustin@566: var selection = grid.getView().getSelectionModel().getSelection()[0]; raimund@585: Ext.MessageBox.confirm( raimund@585: 'Messung löschen', raimund@585: 'Sind Sie sicher?', raimund@585: function(btn) { raimund@585: if (btn === 'yes') { raimund@585: selection.destroy({ raimund@585: success: function() { raimund@585: button.up('window').initData(); raimund@585: }, raimund@585: failure: function() { raimund@585: } raimund@585: }); raimund@585: } dustin@566: }); dustin@566: } dustin@566: });