# HG changeset patch # User Dustin Demuth # Date 1427270840 -3600 # Node ID 612f4f933083284ef1f3e160de93fa047f93db84 # Parent 7b6467edfdfc1c118f712c4b6c389b54d6776b5a Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin diff -r 7b6467edfdfc -r 612f4f933083 app/view/grid/MKommentar.js --- a/app/view/grid/MKommentar.js Wed Mar 25 08:33:13 2015 +0100 +++ b/app/view/grid/MKommentar.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]; this.dockedItems = [{ xtype: 'toolbar', diff -r 7b6467edfdfc -r 612f4f933083 app/view/grid/Messwert.js --- a/app/view/grid/Messwert.js Wed Mar 25 08:33:13 2015 +0100 +++ b/app/view/grid/Messwert.js Wed Mar 25 09:07:20 2015 +0100 @@ -31,8 +31,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]; diff -r 7b6467edfdfc -r 612f4f933083 app/view/grid/PKommentar.js --- 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', diff -r 7b6467edfdfc -r 612f4f933083 app/view/grid/Probenzusatzwert.js --- a/app/view/grid/Probenzusatzwert.js Wed Mar 25 08:33:13 2015 +0100 +++ b/app/view/grid/Probenzusatzwert.js Wed Mar 25 09:07:20 2015 +0100 @@ -29,7 +29,17 @@ 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 = [{ diff -r 7b6467edfdfc -r 612f4f933083 app/view/grid/Status.js --- 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', {