diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/controller/grid/Messung.js	Wed Mar 11 15:21:27 2015 +0100
@@ -0,0 +1,65 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out
+ * the documentation coming with IMIS-Labordaten-Application for details.
+ */
+
+/*
+ * Controller for a Messungengrid
+ */
+Ext.define('Lada.controller.grid.Messung', {
+    extend: 'Ext.app.Controller',
+
+    requires: [
+        'Lada.view.window.MessungEdit'
+    ],
+
+    init: function() {
+        this.control({
+            'messungengrid': {
+                itemdblclick: this.editItem
+            },
+            'messungengrid button[action=add]': {
+                click: this.add
+            },
+            'messungengrid button[action=delete]': {
+                click: this.remove
+            }
+        });
+    },
+
+    editItem: function(grid, record) {
+        console.log(record);
+        var win = Ext.create('Lada.view.window.MessungEdit', {
+            record: record
+        });
+        win.show();
+        win.initData();
+    },
+
+    add: function() {
+        // TODO
+        console.log('add');
+    },
+
+    remove: function(button) {
+        var grid = button.up('grid');
+        var selection = grid.getView().getSelectionModel().getSelection()[0];
+        Ext.MessageBox.confirm(
+            'Messung löschen',
+            'Sind Sie sicher?',
+            function(btn) {
+                if (btn === 'yes') {
+                    selection.destroy({
+                        success: function() {
+                            button.up('window').initData();
+                        },
+                        failure: function() {
+                        }
+                    });
+                }
+        });
+    }
+});

http://lada.wald.intevation.org