comparison app/controller/grid/Ort.js @ 587:cf328526b5bb

Moved controller into subfolders.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 11 Mar 2015 13:39:04 +0100
parents
children e1ab24758392
comparison
equal deleted inserted replaced
586:a9268f5cde26 587:cf328526b5bb
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.grid.Ort', {
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 success: function() {
39 context.grid.store.reload();
40 context.grid.up('window').initData();
41 },
42 failure: function() {
43 // TODO
44 }
45 });
46 },
47
48 open: function() {
49 // todo
50 console.log('open');
51 },
52
53 add: function() {
54 // todo
55 console.log('add');
56 },
57
58 remove: function(button) {
59 var grid = button.up('grid');
60 var selection = grid.getView().getSelectionModel().getSelection()[0];
61 Ext.MessageBox.confirm('Ortsangabe löschen', 'Sind Sie sicher?', function(btn) {
62 if (btn === 'yes') {
63 selection.destroy({
64 success: function() {
65 button.up('window').initData();
66 },
67 failure: function() {
68 }
69 });
70 }
71 });
72 }
73 });

http://lada.wald.intevation.org