[Lada-commits] [PATCH 2 of 2] Rowediting is now disabled when the Grid was set to ReadOnly

Wald Commits scm-commit at wald.intevation.org
Fri Mar 27 11:09:20 CET 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1427450590 -3600
# Node ID 9ab7b1eed9f8804581dbc12c20d8a6ea45900371
# Parent  0c8e689f3bcb60eabbfae888ec7deb8c4dc3bc7c
Rowediting is now disabled when the Grid was set to ReadOnly

diff -r 0c8e689f3bcb -r 9ab7b1eed9f8 app/view/grid/MKommentar.js
--- a/app/view/grid/MKommentar.js	Fri Mar 27 10:20:22 2015 +0100
+++ b/app/view/grid/MKommentar.js	Fri Mar 27 11:03:10 2015 +0100
@@ -26,18 +26,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',
diff -r 0c8e689f3bcb -r 9ab7b1eed9f8 app/view/grid/Messwert.js
--- a/app/view/grid/Messwert.js	Fri Mar 27 10:20:22 2015 +0100
+++ b/app/view/grid/Messwert.js	Fri Mar 27 11:03:10 2015 +0100
@@ -32,12 +32,16 @@
         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;
diff -r 0c8e689f3bcb -r 9ab7b1eed9f8 app/view/grid/PKommentar.js
--- 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',
diff -r 0c8e689f3bcb -r 9ab7b1eed9f8 app/view/grid/Probenzusatzwert.js
--- a/app/view/grid/Probenzusatzwert.js	Fri Mar 27 10:20:22 2015 +0100
+++ b/app/view/grid/Probenzusatzwert.js	Fri Mar 27 11:03:10 2015 +0100
@@ -30,6 +30,7 @@
         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
@@ -38,7 +39,7 @@
                 beforeedit: function(e, o) {
                     var readonlywin = o.grid.up('window').record.get('readonly');
                     var readonlygrid = o.record.get('readonly');
-                    if (readonlywin == true || readonlygrid == true)  {
+                    if (readonlywin == true || readonlygrid == true || this.disabled)  {
                         return false;
                     }
                     return true;
diff -r 0c8e689f3bcb -r 9ab7b1eed9f8 app/view/grid/Status.js
--- a/app/view/grid/Status.js	Fri Mar 27 10:20:22 2015 +0100
+++ b/app/view/grid/Status.js	Fri Mar 27 11:03:10 2015 +0100
@@ -26,12 +26,16 @@
         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;


More information about the Lada-commits mailing list