changeset 702:0c8e689f3bcb

Added readonly to models, Probenzusatzwertgrid does now check wheter a record is readonly and disables the roweditor in such a case
author Dustin Demuth <dustin@intevation.de>
date Fri, 27 Mar 2015 10:20:22 +0100
parents f0bc5387abcc
children 9ab7b1eed9f8
files app/model/MKommentar.js app/model/Messung.js app/model/Messwert.js app/model/Ort.js app/model/PKommentar.js app/model/Probenzusatz.js app/model/Status.js app/model/Zusatzwert.js app/view/grid/Probenzusatzwert.js
diffstat 9 files changed, 34 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/app/model/MKommentar.js	Fri Mar 27 09:38:13 2015 +0100
+++ b/app/model/MKommentar.js	Fri Mar 27 10:20:22 2015 +0100
@@ -18,6 +18,10 @@
         name: 'owner',
         type: 'boolean'
     }, {
+        name: 'readonly',
+        type: 'boolean',
+        persist: false
+    }, {
         name: 'messungsId'
     }, {
         name: 'erzeuger'
--- a/app/model/Messung.js	Fri Mar 27 09:38:13 2015 +0100
+++ b/app/model/Messung.js	Fri Mar 27 10:20:22 2015 +0100
@@ -19,7 +19,8 @@
         type: 'boolean'
     }, {
         name: 'readonly',
-        type: 'boolean'
+        type: 'boolean',
+        persist: false
     }, {
         name: 'probeId'
     }, {
--- a/app/model/Messwert.js	Fri Mar 27 09:38:13 2015 +0100
+++ b/app/model/Messwert.js	Fri Mar 27 10:20:22 2015 +0100
@@ -18,6 +18,10 @@
         name: 'owner',
         type: 'boolean'
     }, {
+        name: 'readonly',
+        type: 'boolean',
+        persist: false
+    }, {
         name: 'messungsId'
     }, {
         name: 'messgroesseId'
--- a/app/model/Ort.js	Fri Mar 27 09:38:13 2015 +0100
+++ b/app/model/Ort.js	Fri Mar 27 10:20:22 2015 +0100
@@ -18,6 +18,10 @@
         name: 'owner',
         type: 'boolean'
     }, {
+        name: 'readonly',
+        type: 'boolean',
+        persist: false
+    }, {
         name: 'ort'
     }, {
         name: 'probeId'
--- a/app/model/PKommentar.js	Fri Mar 27 09:38:13 2015 +0100
+++ b/app/model/PKommentar.js	Fri Mar 27 10:20:22 2015 +0100
@@ -18,6 +18,10 @@
         name: 'owner',
         type: 'boolean'
     }, {
+        name: 'readonly',
+        type: 'boolean',
+        persist: false
+    }, {
         name: 'probeId'
     }, {
         name: 'erzeuger'
--- a/app/model/Probenzusatz.js	Fri Mar 27 09:38:13 2015 +0100
+++ b/app/model/Probenzusatz.js	Fri Mar 27 10:20:22 2015 +0100
@@ -26,6 +26,10 @@
         name: 'owner',
         type: 'boolean'
     }, {
+        name: 'readonly',
+        type: 'boolean',
+        persist: false
+    }, {
         name: 'beschreibung'
     }, {
         name: 'mehId',
--- a/app/model/Status.js	Fri Mar 27 09:38:13 2015 +0100
+++ b/app/model/Status.js	Fri Mar 27 10:20:22 2015 +0100
@@ -18,6 +18,10 @@
         name: 'owner',
         type: 'boolean'
     }, {
+        name: 'readonly',
+        type: 'boolean',
+        persist: false
+    }, {
         name: 'messungsId'
     }, {
         name: 'erzeuger'
--- a/app/model/Zusatzwert.js	Fri Mar 27 09:38:13 2015 +0100
+++ b/app/model/Zusatzwert.js	Fri Mar 27 10:20:22 2015 +0100
@@ -18,6 +18,10 @@
         name: 'owner',
         type: 'boolean'
     }, {
+        name: 'readonly',
+        type: 'boolean',
+        persist: false
+    }, {
         name: 'probeId'
     }, {
         name: 'pzsId'
--- a/app/view/grid/Probenzusatzwert.js	Fri Mar 27 09:38:13 2015 +0100
+++ b/app/view/grid/Probenzusatzwert.js	Fri Mar 27 10:20:22 2015 +0100
@@ -34,8 +34,11 @@
             listeners:{
                 // Make row ineditable when readonly is set to true
                 // Normally this would belong into a controller an not the view.
+                // But the RowEditPlugin is not handled there.
                 beforeedit: function(e, o) {
-                    if (o.record.get('readonly') == true) {
+                    var readonlywin = o.grid.up('window').record.get('readonly');
+                    var readonlygrid = o.record.get('readonly');
+                    if (readonlywin == true || readonlygrid == true)  {
                         return false;
                     }
                     return true;

http://lada.wald.intevation.org