diff app/view/window/MessungEdit.js @ 965:a2c2039bb5d9

Disabled StatusGrid Edit when StatusEdit ist false, Load StatuswerteStore differently, removed a bunch of trailing commas
author Dustin Demuth <dustin@intevation.de>
date Thu, 12 Nov 2015 14:25:07 +0100
parents 8054232535ba
children bf7bb9583a40
line wrap: on
line diff
--- a/app/view/window/MessungEdit.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/view/window/MessungEdit.js	Thu Nov 12 14:25:07 2015 +0100
@@ -171,6 +171,13 @@
                 else {
                     this.enableForm();
                 }
+                //Check if it is allowed to edit Status
+                if (this.record.get('statusEdit') === true) {
+                    this.enableStatusEdit();
+                }
+                else {
+                    this.disableStatusEdit();
+                }
             },
             scope: this
         });
@@ -200,10 +207,9 @@
     disableChildren: function() {
             this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(true);
             this.down('fset[name=messwerte]').down('messwertgrid').readOnly = true;
-            this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(true);
-            this.down('fset[name=messungstatus]').down('statusgrid').readOnly = true;
             this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(true);
             this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = true;
+            this.disableStatusEdit();
     },
 
     /**
@@ -212,11 +218,26 @@
     enableChildren: function() {
             this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(false);
             this.down('fset[name=messwerte]').down('messwertgrid').readOnly = false;
+            this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(false);
+            this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = false;
+            this.enableStatusEdit();
+    },
+
+    /**
+     * Enable to edit the statusgrid
+     */
+     enableStatusEdit: function () {
             this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(false);
             this.down('fset[name=messungstatus]').down('statusgrid').readOnly = false;
-            this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(false);
-            this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = false;
-    },
+     },
+
+    /**
+     * Disable to edit the statusgrid
+     */
+     disableStatusEdit: function () {
+            this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(true);
+            this.down('fset[name=messungstatus]').down('statusgrid').readOnly = true;
+     },
 
     /**
      * Instructs the fields / forms listed in this method to set a message.

http://lada.wald.intevation.org