annotate app/controller/ProbenzusatzwertGrid.js @ 571:1dedce48e3e1

Implemented the 'add' button; fixed renderer and controller.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 10 Mar 2015 12:11:50 +0100
parents 98dee8166459
children 8d2cf853eed2
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
571
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 560
diff changeset
38 add: function(button) {
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 560
diff changeset
39 var record = Ext.create('Lada.model.Zusatzwert', {
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 560
diff changeset
40 probeId: button.up('probenzusatzwertgrid').recordId
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 560
diff changeset
41 });
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 560
diff changeset
42 button.up('probenzusatzwertgrid').store.insert(0, record);
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 560
diff changeset
43 button.up('probenzusatzwertgrid').rowEditing.startEdit(0, 1);
560
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 },
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 remove: function(button) {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 var grid = button.up('grid');
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 var selection = grid.getView().getSelectionModel().getSelection()[0];
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 if (btn === 'yes') {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 selection.destroy({
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 success: function() {
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 button.up('window').initData();
571
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 560
diff changeset
54 grid.initData();
560
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 failure: function() {
571
1dedce48e3e1 Implemented the 'add' button; fixed renderer and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 560
diff changeset
57 // TODO
560
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 }
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 });
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 }
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 });
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 }
98dee8166459 Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 });

http://lada.wald.intevation.org