comparison app/controller/ProbenzusatzwertGrid.js @ 560:98dee8166459

Added probenzusatzwert controller.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 06 Mar 2015 17:06:01 +0100
parents
children 34b2654af158 1dedce48e3e1
comparison
equal deleted inserted replaced
559:9a414a49dffe 560:98dee8166459
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 Ext.define('Lada.controller.ProbenzusatzwertGrid', {
10 extend: 'Ext.app.Controller',
11
12 init: function() {
13 this.control({
14 'probenzusatzwertgrid': {
15 edit: this.gridSave
16 },
17 'probenzusatzwertgrid button[action=add]': {
18 click: this.add
19 },
20 'probenzusatzwertgrid button[action=delete]': {
21 click: this.remove
22 }
23 });
24 },
25
26 gridSave: function(editor, context) {
27 context.record.save({
28 success: function() {
29 context.grid.store.reload();
30 context.grid.up('window').initData();
31 },
32 failure: function() {
33 // TODO
34 }
35 });
36 },
37
38 add: function() {
39 console.log('add');
40 },
41
42 remove: function(button) {
43 var grid = button.up('grid');
44 var selection = grid.getView().getSelectionModel().getSelection()[0];
45 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) {
46 if (btn === 'yes') {
47 selection.destroy({
48 success: function() {
49 button.up('window').initData();
50 },
51 failure: function() {
52 }
53 });
54 }
55 });
56 }
57 });

http://lada.wald.intevation.org