Mercurial > lada > lada-client
comparison app/controller/grid/Messung.js @ 588:e24bc8cf8e1d
Renamed messungen grid and controller.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 11 Mar 2015 15:21:27 +0100 |
parents | |
children | f2742f9b5a64 |
comparison
equal
deleted
inserted
replaced
587:cf328526b5bb | 588:e24bc8cf8e1d |
---|---|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz | |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out | |
6 * the documentation coming with IMIS-Labordaten-Application for details. | |
7 */ | |
8 | |
9 /* | |
10 * Controller for a Messungengrid | |
11 */ | |
12 Ext.define('Lada.controller.grid.Messung', { | |
13 extend: 'Ext.app.Controller', | |
14 | |
15 requires: [ | |
16 'Lada.view.window.MessungEdit' | |
17 ], | |
18 | |
19 init: function() { | |
20 this.control({ | |
21 'messungengrid': { | |
22 itemdblclick: this.editItem | |
23 }, | |
24 'messungengrid button[action=add]': { | |
25 click: this.add | |
26 }, | |
27 'messungengrid button[action=delete]': { | |
28 click: this.remove | |
29 } | |
30 }); | |
31 }, | |
32 | |
33 editItem: function(grid, record) { | |
34 console.log(record); | |
35 var win = Ext.create('Lada.view.window.MessungEdit', { | |
36 record: record | |
37 }); | |
38 win.show(); | |
39 win.initData(); | |
40 }, | |
41 | |
42 add: function() { | |
43 // TODO | |
44 console.log('add'); | |
45 }, | |
46 | |
47 remove: function(button) { | |
48 var grid = button.up('grid'); | |
49 var selection = grid.getView().getSelectionModel().getSelection()[0]; | |
50 Ext.MessageBox.confirm( | |
51 'Messung löschen', | |
52 'Sind Sie sicher?', | |
53 function(btn) { | |
54 if (btn === 'yes') { | |
55 selection.destroy({ | |
56 success: function() { | |
57 button.up('window').initData(); | |
58 }, | |
59 failure: function() { | |
60 } | |
61 }); | |
62 } | |
63 }); | |
64 } | |
65 }); |