changeset 683:612f4f933083

Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
author Dustin Demuth <dustin@intevation.de>
date Wed, 25 Mar 2015 09:07:20 +0100
parents 7b6467edfdfc
children 69cb367c0a63
files app/view/grid/MKommentar.js app/view/grid/Messwert.js app/view/grid/PKommentar.js app/view/grid/Probenzusatzwert.js app/view/grid/Status.js
diffstat 5 files changed, 59 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/app/view/grid/MKommentar.js	Wed Mar 25 08:33:13 2015 +0100
+++ b/app/view/grid/MKommentar.js	Wed Mar 25 09:07:20 2015 +0100
@@ -25,8 +25,18 @@
     initComponent: function() {
         this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
             clicksToMoveEditor: 1,
-            autoCancel: false
-        });
+            autoCancel: false,
+            listeners:{
+                // Make row ineditable when readonly is set to true
+                // Normally this would belong into a controller an not the view.
+                beforeedit: function(e, o) {
+                    if (o.record.get('readonly') == true) {
+                        return false;
+                    }
+                    return true;
+                }
+            }
+         });
         this.plugins = [this.rowEditing];
         this.dockedItems = [{
             xtype: 'toolbar',
--- a/app/view/grid/Messwert.js	Wed Mar 25 08:33:13 2015 +0100
+++ b/app/view/grid/Messwert.js	Wed Mar 25 09:07:20 2015 +0100
@@ -31,8 +31,18 @@
     initComponent: function() {
         this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
             clicksToMoveEditor: 1,
-            autoCancel: false
-        });
+            autoCancel: false,
+            listeners:{
+                // Make row ineditable when readonly is set to true
+                // Normally this would belong into a controller an not the view.
+                beforeedit: function(e, o) {
+                    if (o.record.get('readonly') == true) {
+                        return false;
+                    }
+                    return true;
+                }
+            }
+         });
 
         this.plugins = [this.rowEditing];
 
--- a/app/view/grid/PKommentar.js	Wed Mar 25 08:33:13 2015 +0100
+++ b/app/view/grid/PKommentar.js	Wed Mar 25 09:07:20 2015 +0100
@@ -30,8 +30,18 @@
     initComponent: function() {
         this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
             clicksToMoveEditor: 1,
-            autoCancel: false
-        });
+            autoCancel: false,
+            listeners:{
+                // Make row ineditable when readonly is set to true
+                // Normally this would belong into a controller an not the view.
+                beforeedit: function(e, o) {
+                    if (o.record.get('readonly') == true) {
+                        return false;
+                    }
+                    return true;
+                }
+            }
+         });
         this.plugins = [this.rowEditing];
         this.dockedItems = [{
             xtype: 'toolbar',
--- a/app/view/grid/Probenzusatzwert.js	Wed Mar 25 08:33:13 2015 +0100
+++ b/app/view/grid/Probenzusatzwert.js	Wed Mar 25 09:07:20 2015 +0100
@@ -29,7 +29,17 @@
     initComponent: function() {
         this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
             clicksToMoveEditor: 1,
-            autoCancel: false
+            autoCancel: false,
+            listeners:{
+                // Make row ineditable when readonly is set to true
+                // Normally this would belong into a controller an not the view.
+                beforeedit: function(e, o) {
+                    if (o.record.get('readonly') == true) {
+                        return false;
+                    }
+                    return true;
+                }
+            }
         });
         this.plugins = [this.rowEditing];
         this.dockedItems = [{
--- a/app/view/grid/Status.js	Wed Mar 25 08:33:13 2015 +0100
+++ b/app/view/grid/Status.js	Wed Mar 25 09:07:20 2015 +0100
@@ -25,8 +25,18 @@
     initComponent: function() {
         this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
             clicksToMoveEditor: 1,
-            autoCancel: false
-        });
+            autoCancel: false,
+            listeners:{
+                // Make row ineditable when readonly is set to true
+                // Normally this would belong into a controller an not the view.
+                beforeedit: function(e, o) {
+                    if (o.record.get('readonly') == true) {
+                        return false;
+                    }
+                    return true;
+                }
+            }
+         });
         this.plugins = [this.rowEditing];
 
         var statusStore = Ext.create('Ext.data.Store', {

http://lada.wald.intevation.org