comparison app/controller/MessungenGrid.js @ 574:8d2cf853eed2

merged.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 10 Mar 2015 14:33:03 +0100
parents 8ebe4cfca4b8
children 5af82dc8612d
comparison
equal deleted inserted replaced
573:6a1af698510e 574:8d2cf853eed2
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
2 * Software engineering by Intevation GmbH
3 *
4 * This file is Free Software under the GNU GPL (v>=3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6 * the documentation coming with IMIS-Labordaten-Application for details.
7 */
8
9 /*
10 * Controller for a Messungengrid
11 */
12 Ext.define('Lada.controller.MessungenGrid', {
13 extend: 'Ext.app.Controller',
14
15 init: function() {
16 this.control({
17 'messungengrid': {
18 selectionchange: this.selectionChanged,
19 edit: this.gridSave
20 },
21 'messungengrid button[action=open]': {
22 click: this.open
23 },
24 'messungengrid button[action=add]': {
25 click: this.add
26 },
27 'messungengrid button[action=delete]': {
28 click: this.remove
29 }
30 });
31 },
32
33 selectionChanged: function(grid, record) {
34 if (record) {
35 grid.view.panel.down('button[action=open]').enable();
36 }
37 },
38
39 gridSave: function(editor, context) {
40 context.record.save({
41 success: function() {
42 context.grid.store.reload();
43 context.grid.up('window').initData();
44 },
45 failure: function() {
46 // TODO
47 }
48 });
49 },
50
51 open: function() {
52 // todo
53 console.log('open');
54 },
55
56 add: function() {
57 // todo
58 console.log('add');
59 },
60
61 remove: function(button) {
62 var grid = button.up('grid');
63 var selection = grid.getView().getSelectionModel().getSelection()[0];
64 Ext.MessageBox.confirm('Messung löschen', 'Sind Sie sicher?', function(btn) {
65 if (btn === 'yes') {
66 selection.destroy({
67 success: function() {
68 button.up('window').initData();
69 },
70 failure: function() {
71 }
72 });
73 }
74 });
75 }
76 });

http://lada.wald.intevation.org