diff app/view/grid/Messwert.js @ 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 7ede89336dbe
children 69cb367c0a63
line wrap: on
line diff
--- 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];
 

http://lada.wald.intevation.org