diff app/view/window/MessungEdit.js @ 693:817524db4017

Readonly was missing
author Dustin Demuth <dustin@intevation.de>
date Thu, 26 Mar 2015 15:54:50 +0100
parents e88381fb3bdb
children b0f1dcdf981d
line wrap: on
line diff
--- a/app/view/window/MessungEdit.js	Thu Mar 26 14:13:47 2015 +0100
+++ b/app/view/window/MessungEdit.js	Thu Mar 26 15:54:50 2015 +0100
@@ -96,6 +96,7 @@
 
     initData: function() {
         this.clearMessages();
+        var that = this;
         Ext.ClassManager.get('Lada.model.Messung').load(this.record.get('id'), {
             failure: function(record) {
                 // TODO
@@ -117,6 +118,7 @@
                             }
                             else {
                                 me.record.set('treeModified', me.probe.get('treeModified'));
+                                that.disableForm();
                             }
                         }
                     });
@@ -130,6 +132,32 @@
             },
             scope: this
         });
+        console.log(this.record);
+        if (this.record.get('readonly') == true){
+            this.disableForm();
+        }
+    },
+
+    disableForm: function(){
+        this.down('messungform').setReadOnly(true);
+        this.disableChildren();
+    },
+
+    enableForm: function(){
+        this.down('messungform').setReadOnly(false);
+        this.enableChildren();
+    },
+
+    disableChildren: function(){
+            this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(true);
+            this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(true);
+            this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(true);
+    },
+
+    enableChildren: function(){
+            this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(false);
+            this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(false);
+            this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(false);
     },
 
     setMessages: function(errors, warnings) {

http://lada.wald.intevation.org