annotate app/controller/MessungenGrid.js @ 581:424802824648

Added a form for Messungen (unfinished)
author Dustin Demuth <dustin@intevation.de>
date Tue, 10 Mar 2015 17:12:53 +0100
parents 5af82dc8612d
children 4251601c6305
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
577
5af82dc8612d Removed Detail Button from MessungenGrid, Added Operation in Messungengrid controller to open a detailed view after a doubleclick.
Dustin Demuth <dustin@intevation.de>
parents: 566
diff changeset
15 requires: [
5af82dc8612d Removed Detail Button from MessungenGrid, Added Operation in Messungengrid controller to open a detailed view after a doubleclick.
Dustin Demuth <dustin@intevation.de>
parents: 566
diff changeset
16 'Lada.view.window.MessungEdit'
5af82dc8612d Removed Detail Button from MessungenGrid, Added Operation in Messungengrid controller to open a detailed view after a doubleclick.
Dustin Demuth <dustin@intevation.de>
parents: 566
diff changeset
17 ],
5af82dc8612d Removed Detail Button from MessungenGrid, Added Operation in Messungengrid controller to open a detailed view after a doubleclick.
Dustin Demuth <dustin@intevation.de>
parents: 566
diff changeset
18
566
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
19 init: function() {
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
20 this.control({
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
21 'messungengrid': {
577
5af82dc8612d Removed Detail Button from MessungenGrid, Added Operation in Messungengrid controller to open a detailed view after a doubleclick.
Dustin Demuth <dustin@intevation.de>
parents: 566
diff changeset
22 itemdblclick: this.open
566
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
577
5af82dc8612d Removed Detail Button from MessungenGrid, Added Operation in Messungengrid controller to open a detailed view after a doubleclick.
Dustin Demuth <dustin@intevation.de>
parents: 566
diff changeset
51 open: function(grid, record) {
5af82dc8612d Removed Detail Button from MessungenGrid, Added Operation in Messungengrid controller to open a detailed view after a doubleclick.
Dustin Demuth <dustin@intevation.de>
parents: 566
diff changeset
52 //Opens a detailed view of the Messung
5af82dc8612d Removed Detail Button from MessungenGrid, Added Operation in Messungengrid controller to open a detailed view after a doubleclick.
Dustin Demuth <dustin@intevation.de>
parents: 566
diff changeset
53 var win = Ext.create('Lada.view.window.MessungEdit', {
5af82dc8612d Removed Detail Button from MessungenGrid, Added Operation in Messungengrid controller to open a detailed view after a doubleclick.
Dustin Demuth <dustin@intevation.de>
parents: 566
diff changeset
54 record: this.record
5af82dc8612d Removed Detail Button from MessungenGrid, Added Operation in Messungengrid controller to open a detailed view after a doubleclick.
Dustin Demuth <dustin@intevation.de>
parents: 566
diff changeset
55 });
5af82dc8612d Removed Detail Button from MessungenGrid, Added Operation in Messungengrid controller to open a detailed view after a doubleclick.
Dustin Demuth <dustin@intevation.de>
parents: 566
diff changeset
56 win.show();
5af82dc8612d Removed Detail Button from MessungenGrid, Added Operation in Messungengrid controller to open a detailed view after a doubleclick.
Dustin Demuth <dustin@intevation.de>
parents: 566
diff changeset
57 win.initData();
566
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
58 // todo
577
5af82dc8612d Removed Detail Button from MessungenGrid, Added Operation in Messungengrid controller to open a detailed view after a doubleclick.
Dustin Demuth <dustin@intevation.de>
parents: 566
diff changeset
59 console.log('opened window');
566
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
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
62 add: function() {
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
63 // todo
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
64 console.log('add');
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
65 },
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
66
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
67 remove: function(button) {
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
68 var grid = button.up('grid');
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
69 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
70 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
71 if (btn === 'yes') {
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
72 selection.destroy({
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
73 success: function() {
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
74 button.up('window').initData();
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 failure: function() {
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
77 }
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
78 });
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
79 }
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
80 });
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
81 }
8ebe4cfca4b8 Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
82 });

http://lada.wald.intevation.org