[Lada-commits] [PATCH] Use readonly flag to set edit status of UI

Wald Commits scm-commit at wald.intevation.org
Wed Mar 29 14:27:24 CEST 2017


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1490790440 -7200
# Node ID 01f083db45b7e5edf88e9c3c87dc2fe0c638a0ca
# Parent  3ecf993c250a36fae55b05f46f4afc51b82a156f
Use readonly flag to set edit status of UI

diff -r 3ecf993c250a -r 01f083db45b7 app/controller/grid/Messmethode.js
--- a/app/controller/grid/Messmethode.js	Wed Mar 29 08:49:56 2017 +0200
+++ b/app/controller/grid/Messmethode.js	Wed Mar 29 14:27:20 2017 +0200
@@ -143,8 +143,8 @@
         //Set Store
         ngrid.setData(mmtmessgroessenstore);
 
-        //Enable Editing
-        ngrid.setReadOnly(false);
+        //Enable Editing depending on the readonly state of the messprogramm.
+        ngrid.setReadOnly(row.view.up('window').record.get('readonly'));
     },
 
     /**
diff -r 3ecf993c250a -r 01f083db45b7 app/model/Messprogramm.js
--- a/app/model/Messprogramm.js	Wed Mar 29 08:49:56 2017 +0200
+++ b/app/model/Messprogramm.js	Wed Mar 29 14:27:20 2017 +0200
@@ -78,6 +78,10 @@
     }, {
         name: 'media',
         persist: false
+    }, {
+        name: 'readonly',
+        type: 'boolean',
+        persist: false
     }],
 
     idProperty: 'id',
diff -r 3ecf993c250a -r 01f083db45b7 app/view/form/Messprogramm.js
--- a/app/view/form/Messprogramm.js	Wed Mar 29 08:49:56 2017 +0200
+++ b/app/view/form/Messprogramm.js	Wed Mar 29 14:27:20 2017 +0200
@@ -665,7 +665,25 @@
     },
 
     setReadOnly: function(value) {
-        // TODO
+        this.down('cbox[name=mstlabor]').setReadOnly(value);
+        this.down('cbox[name=datenbasisId]').setReadOnly(value);
+        this.down('cbox[name=baId]').setReadOnly(value);
+        this.down('chkbox[name=test]').setReadOnly(value);
+        this.down('cbox[name=probenartId]').setReadOnly(value);
+        this.down('netzbetreiber').setReadOnly(value);
+        this.down('cbox[name=probenintervall]').setReadOnly(value);
+        this.down('numfield[name=teilintervallVon]').setReadOnly(value);
+        this.down('numfield[name=teilintervallBis]').setReadOnly(value);
+        this.down('numfield[name=intervallOffset]').setReadOnly(value);
+        this.down('dayofyear[name=gueltigVon]').setReadOnly(value);
+        this.down('dayofyear[name=gueltigBis]').setReadOnly(value);
+        this.down('cbox[name=umwId]').setReadOnly(value);
+        this.down('cbox[name=probeNehmerId]').setReadOnly(value);
+        this.down('messprogrammland[name=mplId]').setReadOnly(value);
+        this.down('probenintervallslider').setReadOnly(value);
+        for (var i = 0; i < 12; i++) {
+            this.down('deskriptor[layer='+i+']').setReadOnly(value);
+        }
     },
 
     buildDescriptors: function() {
diff -r 3ecf993c250a -r 01f083db45b7 app/view/widget/DayOfYear.js
--- a/app/view/widget/DayOfYear.js	Wed Mar 29 08:49:56 2017 +0200
+++ b/app/view/widget/DayOfYear.js	Wed Mar 29 14:27:20 2017 +0200
@@ -269,5 +269,10 @@
 
     setValue: function(value) {
         this.down('numberfield[hidden]').setValue(value);
+    },
+
+    setReadOnly: function(value) {
+        this.down('numberfield[hidden=false]').setReadOnly(value);
+        this.down('combobox').setReadOnly(value);
     }
 });
diff -r 3ecf993c250a -r 01f083db45b7 app/view/widget/DynamicGrid.js
--- a/app/view/widget/DynamicGrid.js	Wed Mar 29 08:49:56 2017 +0200
+++ b/app/view/widget/DynamicGrid.js	Wed Mar 29 14:27:20 2017 +0200
@@ -106,7 +106,7 @@
             width: 30,
             getClass: function (val, meta, rec) {
                 if (rec.get('readonly') === false &&
-                    rec.get('owner') === true &&
+                    (rec.get('owner') === true || rec.get('owner') === '') &&
                     !rec.get('statusEdit')) {
                         return 'edit';
                 }
diff -r 3ecf993c250a -r 01f083db45b7 app/view/window/Messprogramm.js
--- a/app/view/window/Messprogramm.js	Wed Mar 29 08:49:56 2017 +0200
+++ b/app/view/window/Messprogramm.js	Wed Mar 29 14:27:20 2017 +0200
@@ -147,7 +147,6 @@
         // create a Edit window
         if (this.record) {
             this.setLoading(true);
-            this.down('messmethodengrid').setReadOnly(false);
             Ext.ClassManager.get('Lada.model.Messprogramm').load(this.record.get('id'), {
                 failure: function(record, action) {
                     me.setLoading(false);
@@ -201,6 +200,7 @@
 
     disableChildren: function() {
         this.down('fset[name=orte]').down('ortszuordnunggrid').setReadOnly(true);
+        this.down('messmethodengrid').setReadOnly(true);
     },
 
     enableChildren: function() {


More information about the Lada-commits mailing list