annotate app/controller/ProbenzusatzwertGrid.js @ 560:98dee8166459

Added probenzusatzwert controller.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 06 Mar 2015 17:06:01 +0100
parents
children 34b2654af158 1dedce48e3e1
rev   line source
560
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 Ext.define('Lada.controller.ProbenzusatzwertGrid', {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 extend: 'Ext.app.Controller',
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 init: function() {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 this.control({
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 'probenzusatzwertgrid': {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 edit: this.gridSave
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 },
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 'probenzusatzwertgrid button[action=add]': {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 click: this.add
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 },
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 'probenzusatzwertgrid button[action=delete]': {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 click: this.remove
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 }
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 });
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 },
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 gridSave: function(editor, context) {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 context.record.save({
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 success: function() {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 context.grid.store.reload();
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 context.grid.up('window').initData();
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 },
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 failure: function() {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 // TODO
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 }
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 });
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 },
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 add: function() {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 console.log('add');
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 },
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 remove: function(button) {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 var grid = button.up('grid');
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 var selection = grid.getView().getSelectionModel().getSelection()[0];
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 if (btn === 'yes') {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 selection.destroy({
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 success: function() {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 button.up('window').initData();
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 },
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 failure: function() {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 }
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 });
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 }
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 });
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 }
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 });

http://lada.wald.intevation.org