changeset 1329:053bd0cd9744

check the correct grid to avoid editing.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 03 Feb 2017 15:31:49 +0100 (2017-02-03)
parents cf73b7d7cf99
children 7827033c9998
files app/controller/Ort.js
diffstat 1 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Ort.js	Fri Feb 03 15:31:18 2017 +0100
+++ b/app/controller/Ort.js	Fri Feb 03 15:31:49 2017 +0100
@@ -23,12 +23,12 @@
             'ortpanel ortstammdatengrid': {
                 edit: me.gridSave,
                 canceledit: me.cancelEdit,
-                select: me.select
+                select: me.selectPanel
             },
             'ortszuordnungwindow ortstammdatengrid': {
                 edit: me.gridSave,
                 canceledit: me.cancelEdit,
-                select: me.select
+                select: me.selectWindow
             },
             'ortpanel map': {
                 featureadded: me.featureadded
@@ -101,12 +101,27 @@
         grid.up('ortpanel').down('button[action=delete]').disable();
     },
 
-    select: function(rowModel, record) {
-        this.checkEdit(rowModel, record);
+    selectPanel: function(rowModel, record) {
+        this.checkEditPanel(rowModel, record);
         this.buttonToggle(rowModel, record);
     },
 
-    checkEdit: function(rowModel, record) {
+    selectWindow: function(rowModel, record) {
+        this.checkEditWindow(rowModel, record);
+        this.buttonToggle(rowModel, record);
+    },
+
+    checkEditWindow: function(rowModel, record) {
+        if (!Ext.Array.contains(Lada.netzbetreiber,
+            record.get('netzbetreiberId')) &&
+            record.get('netzbetreiberId') !== '') {
+            var grid = Ext.ComponentQuery.query('ortszuordnungwindow ortstammdatengrid')[0];
+            grid.rowEditing.cancelEdit();
+            return;
+        }
+    },
+
+    checkEditPanel: function(rowModel, record) {
         if (!Ext.Array.contains(Lada.netzbetreiber,
             record.get('netzbetreiberId')) &&
             record.get('netzbetreiberId') !== '') {

http://lada.wald.intevation.org