Mercurial > lada > lada-client
comparison app/controller/OrtGrid.js @ 548:d47ee7439f44
Added new js files.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 06 Mar 2015 12:43:52 +0100 |
parents | |
children | d5ad2f43658a |
comparison
equal
deleted
inserted
replaced
547:f172b35a3b92 | 548:d47ee7439f44 |
---|---|
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.OrtGrid', { | |
10 extend: 'Ext.app.Controller', | |
11 | |
12 init: function() { | |
13 this.control({ | |
14 'ortgrid': { | |
15 selectionchange: this.selectionChanged, | |
16 edit: this.gridSave | |
17 }, | |
18 'ortgrid button[action=open]': { | |
19 click: this.open | |
20 }, | |
21 'ortgrid button[action=add]': { | |
22 click: this.add | |
23 }, | |
24 'ortgrid button[action=delete]': { | |
25 click: this.remove | |
26 } | |
27 }); | |
28 }, | |
29 | |
30 selectionChanged: function(grid, record) { | |
31 if (record) { | |
32 grid.view.panel.down('button[action=open]').enable(); | |
33 } | |
34 }, | |
35 | |
36 gridSave: function(editor, context) { | |
37 context.record.save(); | |
38 context.grid.store.reload(); | |
39 context.grid.up('window').initData(); | |
40 }, | |
41 | |
42 open: function() { | |
43 console.log('open'); | |
44 }, | |
45 | |
46 add: function() { | |
47 console.log('add'); | |
48 }, | |
49 | |
50 remove: function(button) { | |
51 var grid = button.up('grid'); | |
52 var selection = grid.getView().getSelectionModel().getSelection()[0]; | |
53 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', 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 }); |