[Lada-commits] [PATCH] fixed validitycheck in Ortserstellung

Wald Commits scm-commit at wald.intevation.org
Tue Feb 7 15:04:52 CET 2017


# HG changeset patch
# User Maximilian Krambach <mkrambach at intevation.de>
# Date 1486476285 -3600
# Node ID e5235309d4612922a46138a229cf0e8cfb7d4f32
# Parent  036c594de978854c5d63dadaae00f5b3c3a32c9f
fixed validitycheck in Ortserstellung

diff -r 036c594de978 -r e5235309d461 app/controller/form/Ortserstellung.js
--- a/app/controller/form/Ortserstellung.js	Tue Feb 07 14:55:34 2017 +0100
+++ b/app/controller/form/Ortserstellung.js	Tue Feb 07 15:04:45 2017 +0100
@@ -37,7 +37,11 @@
             },
             'ortserstellungsform numfield [name=koordYExtern]': {
                 change: this.checkCommitEnabled
-            }
+            },
+            'ortserstellungsform': {
+                validitychange: this.checkCommitEnabled,
+                dirtychange: this.checkCommitEnabled
+            },
         });
     },
 
@@ -128,12 +132,12 @@
      * checks if the Messpunkt can be committed.
      * Disables the save button if false
      */
-    checkCommitEnabled: function(field) {
+    checkCommitEnabled: function(callingEl) {
         var panel;
-        if (field.up('panel')) {
-            panel = field.up('panel').up('panel');
-        } else {
-            panel = field;
+        if (callingEl.up) { //called by a field in the form
+            panel = callingEl.up('panel').up('panel');
+        } else { //called by the form
+            panel = callingEl.owner;
         }
         var savebutton =  panel.down('button[action=save]');
         var form = panel.getForm();
diff -r 036c594de978 -r e5235309d461 app/view/form/Ortserstellung.js
--- a/app/view/form/Ortserstellung.js	Tue Feb 07 14:55:34 2017 +0100
+++ b/app/view/form/Ortserstellung.js	Tue Feb 07 15:04:45 2017 +0100
@@ -182,8 +182,6 @@
         }];
         this.callParent(arguments);
         this.getForm().loadRecord(this.record);
-        var controller = Lada.app.getController('Lada.controller.form.Ortserstellung')
-        controller.checkCommitEnabled(this);
     },
 
     setMessages: function(errors, warnings) {


More information about the Lada-commits mailing list