annotate app/controller/grid/Ort.js @ 644:71e8b84d7829

Reload grids on messung or ort changed/added.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 17 Mar 2015 16:06:33 +0100
parents 477379250512
children e88381fb3bdb
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.Ort', {
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
602
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
12 requires: [
644
71e8b84d7829 Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 643
diff changeset
13 'Lada.view.window.OrtEdit',
71e8b84d7829 Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 643
diff changeset
14 'Lada.view.window.OrtCreate'
602
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
15 ],
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
16
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 init: function() {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 this.control({
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 'ortgrid': {
602
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
20 itemdblclick: this.open
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 'ortgrid button[action=add]': {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 click: this.add
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 'ortgrid button[action=delete]': {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 click: this.remove
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 });
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30
602
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
31 open: function(grid, record) {
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
32 var win = Ext.create('Lada.view.window.OrtEdit', {
644
71e8b84d7829 Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 643
diff changeset
33 record: record,
71e8b84d7829 Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 643
diff changeset
34 grid: grid
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 });
602
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
36 win.show();
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
37 win.initData();
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39
643
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
40 add: function(button) {
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
41 var probe = button.up('window').record;
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
42 var win = Ext.create('Lada.view.window.OrtCreate', {
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
43 record: probe,
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
44 grid: button.up('ortgrid')
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
45 });
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
46 win.show();
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
47 win.initData();
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 remove: function(button) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 var grid = button.up('grid');
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 var selection = grid.getView().getSelectionModel().getSelection()[0];
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 Ext.MessageBox.confirm('Ortsangabe löschen', 'Sind Sie sicher?', function(btn) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 if (btn === 'yes') {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 selection.destroy({
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 success: function() {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 button.up('window').initData();
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 failure: function() {
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 });
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 });

http://lada.wald.intevation.org