changeset 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 0c8e689f3bcb
children 2d454bfef426
files app/view/grid/MKommentar.js app/view/grid/Messwert.js app/view/grid/PKommentar.js app/view/grid/Probenzusatzwert.js app/view/grid/Status.js
diffstat 5 files changed, 24 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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',
--- 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;
--- 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',
--- 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;
--- 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;

http://lada.wald.intevation.org