diff app/view/grid/PKommentar.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 2c8aa09402a2
children 69cb367c0a63
line wrap: on
line diff
--- 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',

http://lada.wald.intevation.org