annotate app/controller/MessungenGrid.js @ 567:fa52f383daf8

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

http://lada.wald.intevation.org