diff app/view/form/Probe.js @ 681:f373446325b4

a probe can not be edited when the readonly flag was sent by the server
author Dustin Demuth <dustin@intevation.de>
date Tue, 24 Mar 2015 15:33:11 +0100
parents 08e3e7b80a34
children 69cb367c0a63
line wrap: on
line diff
--- a/app/view/form/Probe.js	Tue Mar 24 12:15:39 2015 +0100
+++ b/app/view/form/Probe.js	Tue Mar 24 15:33:11 2015 +0100
@@ -35,9 +35,9 @@
     recordId: null,
 
     trackResetOnLoad: true,
+    readonly: false,
 
     initComponent: function() {
-
         var me = this;
         this.items = [{
             xtype: 'fieldset',
@@ -287,8 +287,11 @@
                 }]
             }]
         }];
+        this.callParent(arguments);
 
-        this.callParent(arguments);
+        if (this.readonly){
+            this.setReadOnly(true);
+        }
     },
 
     setRecord: function(record) {
@@ -344,7 +347,7 @@
         this.down('datetime[name=probeentnahmeEnde]').clearWarningOrError();
         this.down('datetime[name=solldatumBeginn]').clearWarningOrError();
         this.down('datetime[name=solldatumEnde]').clearWarningOrError();
-        //this.down('cbox[name=probeNehmerId]').setReadOnly(value);
+        //this.down('numberfield[name=probeNehmerId]').clearWarningOrError();
     },
 
     setReadOnly: function(value) {
@@ -363,17 +366,22 @@
         this.down('datetime[name=probeentnahmeEnde]').setReadOnly(value);
         this.down('datetime[name=solldatumBeginn]').setReadOnly(value);
         this.down('datetime[name=solldatumEnde]').setReadOnly(value);
-        //this.down('cbox[name=probeNehmerId]').setReadOnly(value);
+        this.down('numberfield[name=probeNehmerId]').setReadOnly(value);
     },
 
     buildDescriptors: function() {
         var fields = [];
+        var ro = false;
+        if (this.readonly) {
+            ro = true;
+        }
         for (var i = 0; i < 12; i++) {
             fields[i] = {
                 fieldLabel: 'S' + i,
                 name: 's' + i,
                 labelWidth: 25,
-                margin: '0, 10, 5, 0'
+                margin: '0, 10, 5, 0',
+                readOnly: ro
             };
         }
         return fields;

http://lada.wald.intevation.org