annotate app/controller/grid/Probenzusatzwert.js @ 600:339741bc6ebf

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

http://lada.wald.intevation.org