Mercurial > lada > lada-client
annotate app/controller/MessungenGrid.js @ 585:4251601c6305
Load status, messwerte and kommentare asynchronously.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 11 Mar 2015 13:13:56 +0100 |
parents | 5af82dc8612d |
children |
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 |
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
|
33 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
|
34 //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
|
35 var win = Ext.create('Lada.view.window.MessungEdit', { |
585
4251601c6305
Load status, messwerte and kommentare asynchronously.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
577
diff
changeset
|
36 record: record |
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
|
37 }); |
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
|
38 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
|
39 win.initData(); |
566
8ebe4cfca4b8
Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
40 }, |
8ebe4cfca4b8
Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
41 |
8ebe4cfca4b8
Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
42 add: function() { |
585
4251601c6305
Load status, messwerte and kommentare asynchronously.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
577
diff
changeset
|
43 // TODO |
566
8ebe4cfca4b8
Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
44 console.log('add'); |
8ebe4cfca4b8
Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
45 }, |
8ebe4cfca4b8
Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
46 |
8ebe4cfca4b8
Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
47 remove: function(button) { |
8ebe4cfca4b8
Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
48 var grid = button.up('grid'); |
8ebe4cfca4b8
Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
49 var selection = grid.getView().getSelectionModel().getSelection()[0]; |
585
4251601c6305
Load status, messwerte and kommentare asynchronously.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
577
diff
changeset
|
50 Ext.MessageBox.confirm( |
4251601c6305
Load status, messwerte and kommentare asynchronously.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
577
diff
changeset
|
51 'Messung löschen', |
4251601c6305
Load status, messwerte and kommentare asynchronously.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
577
diff
changeset
|
52 'Sind Sie sicher?', |
4251601c6305
Load status, messwerte and kommentare asynchronously.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
577
diff
changeset
|
53 function(btn) { |
4251601c6305
Load status, messwerte and kommentare asynchronously.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
577
diff
changeset
|
54 if (btn === 'yes') { |
4251601c6305
Load status, messwerte and kommentare asynchronously.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
577
diff
changeset
|
55 selection.destroy({ |
4251601c6305
Load status, messwerte and kommentare asynchronously.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
577
diff
changeset
|
56 success: function() { |
4251601c6305
Load status, messwerte and kommentare asynchronously.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
577
diff
changeset
|
57 button.up('window').initData(); |
4251601c6305
Load status, messwerte and kommentare asynchronously.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
577
diff
changeset
|
58 }, |
4251601c6305
Load status, messwerte and kommentare asynchronously.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
577
diff
changeset
|
59 failure: function() { |
4251601c6305
Load status, messwerte and kommentare asynchronously.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
577
diff
changeset
|
60 } |
4251601c6305
Load status, messwerte and kommentare asynchronously.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
577
diff
changeset
|
61 }); |
4251601c6305
Load status, messwerte and kommentare asynchronously.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
577
diff
changeset
|
62 } |
566
8ebe4cfca4b8
Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
63 }); |
8ebe4cfca4b8
Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
64 } |
8ebe4cfca4b8
Added a MessungenGridController. "Delete" causes a Code-500 Server Error.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
65 }); |