Mercurial > lada > lada-client
annotate app/controller/ProbenzusatzwertGrid.js @ 568:34b2654af158
More specific 'are your sure?' question on delete
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Tue, 10 Mar 2015 11:57:12 +0100 |
parents | 98dee8166459 |
children | 8d2cf853eed2 |
rev | line source |
---|---|
560
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 Ext.define('Lada.controller.ProbenzusatzwertGrid', { |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 extend: 'Ext.app.Controller', |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 init: function() { |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 this.control({ |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 'probenzusatzwertgrid': { |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 edit: this.gridSave |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 }, |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 'probenzusatzwertgrid button[action=add]': { |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 click: this.add |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 }, |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 'probenzusatzwertgrid button[action=delete]': { |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 click: this.remove |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 } |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 }); |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 }, |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 gridSave: function(editor, context) { |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 context.record.save({ |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 success: function() { |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 context.grid.store.reload(); |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 context.grid.up('window').initData(); |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 }, |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 failure: function() { |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 // TODO |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 } |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 }); |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 }, |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 add: function() { |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 console.log('add'); |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 }, |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 remove: function(button) { |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 var grid = button.up('grid'); |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 var selection = grid.getView().getSelectionModel().getSelection()[0]; |
568
34b2654af158
More specific 'are your sure?' question on delete
Dustin Demuth <dustin@intevation.de>
parents:
560
diff
changeset
|
45 Ext.MessageBox.confirm('Zusatzwert löschen', 'Sind Sie sicher?', function(btn) { |
560
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 if (btn === 'yes') { |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 selection.destroy({ |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 success: function() { |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 button.up('window').initData(); |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 }, |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 failure: function() { |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 } |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 }); |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 } |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 }); |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 } |
98dee8166459
Added probenzusatzwert controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 }); |