Mercurial > lada > lada-client
annotate app/controller/grid/Status.js @ 624:927484545e9b
added xtype for numeric-fields to grid to enable decimalseparator-replacement by locale-config
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Mon, 16 Mar 2015 11:23:38 +0100 |
parents | 89b337cbfb5d |
children | 8acb3123b46c |
rev | line source |
---|---|
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 Ext.define('Lada.controller.grid.Status', { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 extend: 'Ext.app.Controller', |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 init: function() { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 this.control({ |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 'statusgrid': { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 edit: this.gridSave |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 }, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 'statusgrid button[action=add]': { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 click: this.add |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 }, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 'statusgrid button[action=delete]': { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 click: this.remove |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 } |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 }); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 }, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 gridSave: function(editor, context) { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 context.record.save({ |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 success: function() { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 context.grid.initData(); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 context.grid.up('window').initData(); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 }, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 failure: function() { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 // TODO |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 } |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 }); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 }, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 add: function(button) { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 var record = Ext.create('Lada.model.Status', { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 messungsId: button.up('statusgrid').recordId |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 }); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 button.up('statusgrid').store.insert(0, record); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 button.up('statusgrid').rowEditing.startEdit(0, 1); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 }, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 remove: function(button) { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 var grid = button.up('grid'); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 var selection = grid.getView().getSelectionModel().getSelection()[0]; |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 Ext.MessageBox.confirm('Messwert löschen', 'Sind Sie sicher?', function(btn) { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 if (btn === 'yes') { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 selection.destroy({ |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 success: function() { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 button.up('window').initData(); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 grid.initData(); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 }, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 failure: function() { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 // TODO |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 } |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 }); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 } |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 }); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 } |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 }); |