[Lada-commits] [PATCH] a probe can not be edited when the readonly flag was sent by the server

Wald Commits scm-commit at wald.intevation.org
Tue Mar 24 16:01:54 CET 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1427207591 -3600
# Node ID f373446325b4ec1f322dcc1399559ba7abc7bf41
# Parent  31fc4f94f98fa82a4721e7860506721b33ce183a
a probe can not be edited when the readonly flag was sent by the server

diff -r 31fc4f94f98f -r f373446325b4 app/view/form/Probe.js
--- 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;
diff -r 31fc4f94f98f -r f373446325b4 app/view/window/ProbeEdit.js
--- a/app/view/window/ProbeEdit.js	Tue Mar 24 12:15:39 2015 +0100
+++ b/app/view/window/ProbeEdit.js	Tue Mar 24 15:33:11 2015 +0100
@@ -53,7 +53,8 @@
             autoScroll: true,
             items: [{
                 xtype: 'probeform',
-                recordId: this.record.get('id')
+                recordId: this.record.get('id'),
+                readonly: this.record.get('readonly')
              }, {
                 xtype: 'fset',
                 name: 'messungen',


More information about the Lada-commits mailing list