diff app/view/grid/Status.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 1c5a4b419149
children 69cb367c0a63
line wrap: on
line diff
--- 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