annotate app/controller/OrtGrid.js @ 550:b6875e900e3a

Added datetime library.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 06 Mar 2015 12:44:44 +0100
parents d47ee7439f44
children d5ad2f43658a
rev   line source
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 Ext.define('Lada.controller.OrtGrid', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 extend: 'Ext.app.Controller',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 init: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 this.control({
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 'ortgrid': {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 selectionchange: this.selectionChanged,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 edit: this.gridSave
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 'ortgrid button[action=open]': {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 click: this.open
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 'ortgrid button[action=add]': {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 click: this.add
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 'ortgrid button[action=delete]': {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 click: this.remove
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 });
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 selectionChanged: function(grid, record) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 if (record) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 grid.view.panel.down('button[action=open]').enable();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 gridSave: function(editor, context) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 context.record.save();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 context.grid.store.reload();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 context.grid.up('window').initData();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 open: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 console.log('open');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 add: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 console.log('add');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 remove: function(button) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 var grid = button.up('grid');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 var selection = grid.getView().getSelectionModel().getSelection()[0];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 if (btn === 'yes') {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 selection.destroy({
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 success: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 button.up('window').initData();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 failure: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 });
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 });
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 });

http://lada.wald.intevation.org