diff app/view/grid/PKommentar.js @ 703:9ab7b1eed9f8

Rowediting is now disabled when the Grid was set to ReadOnly
author Dustin Demuth <dustin@intevation.de>
date Fri, 27 Mar 2015 11:03:10 +0100
parents 69cb367c0a63
children 5ed0e6273888
line wrap: on
line diff
--- a/app/view/grid/PKommentar.js	Fri Mar 27 10:20:22 2015 +0100
+++ b/app/view/grid/PKommentar.js	Fri Mar 27 11:03:10 2015 +0100
@@ -31,18 +31,22 @@
         this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
             clicksToMoveEditor: 1,
             autoCancel: false,
+            disabled: false,
             pluginId: 'rowedit',
             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 || this.disabled)  {
                         return false;
                     }
                     return true;
                 }
             }
-         });
+        });
         this.plugins = [this.rowEditing];
         this.dockedItems = [{
             xtype: 'toolbar',

http://lada.wald.intevation.org