# HG changeset patch # User Dustin Demuth # Date 1427292285 -3600 # Node ID 69cb367c0a63533326db84befed9080967a050f5 # Parent 612f4f933083284ef1f3e160de93fa047f93db84 When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly. diff -r 612f4f933083 -r 69cb367c0a63 app/view/form/Probe.js --- a/app/view/form/Probe.js Wed Mar 25 09:07:20 2015 +0100 +++ b/app/view/form/Probe.js Wed Mar 25 15:04:45 2015 +0100 @@ -35,7 +35,6 @@ recordId: null, trackResetOnLoad: true, - readonly: false, initComponent: function() { var me = this; @@ -288,10 +287,6 @@ }] }]; this.callParent(arguments); - - if (this.readonly){ - this.setReadOnly(true); - } }, setRecord: function(record) { diff -r 612f4f933083 -r 69cb367c0a63 app/view/grid/MKommentar.js --- a/app/view/grid/MKommentar.js Wed Mar 25 09:07:20 2015 +0100 +++ b/app/view/grid/MKommentar.js Wed Mar 25 15:04:45 2015 +0100 @@ -26,6 +26,7 @@ this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { clicksToMoveEditor: 1, autoCancel: false, + pluginId: 'rowedit', listeners:{ // Make row ineditable when readonly is set to true // Normally this would belong into a controller an not the view. @@ -106,5 +107,23 @@ messungsId: this.recordId } }); + }, + + setReadOnly: function(b) { + if (b == true){ + //Readonly + if (this.getPlugin('rowedit')){ + this.getPlugin('rowedit').disable(); + } + this.down('button[action=delete]').disable(); + this.down('button[action=add]').disable(); + }else{ + //Writable + if (this.getPlugin('rowedit')){ + this.getPlugin('rowedit').enable(); + } + this.down('button[action=delete]').enable(); + this.down('button[action=add]').enable(); + } } }); diff -r 612f4f933083 -r 69cb367c0a63 app/view/grid/Messung.js --- a/app/view/grid/Messung.js Wed Mar 25 09:07:20 2015 +0100 +++ b/app/view/grid/Messung.js Wed Mar 25 15:04:45 2015 +0100 @@ -195,5 +195,23 @@ if (Ext.fly(opts.divId)) { Ext.fly(opts.divId).update(value); } + }, + + setReadOnly: function(b) { + if (b == true){ + //Readonly + if (this.getPlugin('rowedit')){ + this.getPlugin('rowedit').disable(); + } + this.down('button[action=delete]').disable(); + this.down('button[action=add]').disable(); + }else{ + //Writable + if (this.getPlugin('rowedit')){ + this.getPlugin('rowedit').enable(); + } + this.down('button[action=delete]').enable(); + this.down('button[action=add]').enable(); + } } }); diff -r 612f4f933083 -r 69cb367c0a63 app/view/grid/Messwert.js --- a/app/view/grid/Messwert.js Wed Mar 25 09:07:20 2015 +0100 +++ b/app/view/grid/Messwert.js Wed Mar 25 15:04:45 2015 +0100 @@ -32,6 +32,7 @@ this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { clicksToMoveEditor: 1, autoCancel: false, + pluginId: 'rowedit', listeners:{ // Make row ineditable when readonly is set to true // Normally this would belong into a controller an not the view. @@ -163,5 +164,18 @@ messungsId: this.recordId } }); + }, + + setReadOnly: function(b) { + if (b == true){ + //Readonly + if (this.getPlugin('rowedit')){ + this.getPlugin('rowedit').disable(); + } + this.down('button[action=delete]').disable(); + this.down('button[action=add]').disable(); + }else{ + //Writable + } } }); diff -r 612f4f933083 -r 69cb367c0a63 app/view/grid/Ort.js --- a/app/view/grid/Ort.js Wed Mar 25 09:07:20 2015 +0100 +++ b/app/view/grid/Ort.js Wed Mar 25 15:04:45 2015 +0100 @@ -118,10 +118,21 @@ }); }, - - setReadOnly: function() { - this.getPlugin('rowedit').disable(); - this.down('button[action=add]').disable(); - this.down('button[action=delete]').disable(); + setReadOnly: function(b) { + if (b == true){ + //Readonly + if (this.getPlugin('rowedit')){ + this.getPlugin('rowedit').disable(); + } + this.down('button[action=delete]').disable(); + this.down('button[action=add]').disable(); + }else{ + //Writable + if (this.getPlugin('rowedit')){ + this.getPlugin('rowedit').enable(); + } + this.down('button[action=delete]').enable(); + this.down('button[action=add]').enable(); + } } }); diff -r 612f4f933083 -r 69cb367c0a63 app/view/grid/PKommentar.js --- a/app/view/grid/PKommentar.js Wed Mar 25 09:07:20 2015 +0100 +++ b/app/view/grid/PKommentar.js Wed Mar 25 15:04:45 2015 +0100 @@ -31,6 +31,7 @@ this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { clicksToMoveEditor: 1, autoCancel: false, + pluginId: 'rowedit', listeners:{ // Make row ineditable when readonly is set to true // Normally this would belong into a controller an not the view. @@ -109,5 +110,23 @@ probeId: this.recordId } }); + }, + + setReadOnly: function(b) { + if (b == true){ + //Readonly + if (this.getPlugin('rowedit')){ + this.getPlugin('rowedit').disable(); + } + this.down('button[action=delete]').disable(); + this.down('button[action=add]').disable(); + }else{ + //Writable + if (this.getPlugin('rowedit')){ + this.getPlugin('rowedit').enable(); + } + this.down('button[action=delete]').enable(); + this.down('button[action=add]').enable(); + } } }); diff -r 612f4f933083 -r 69cb367c0a63 app/view/grid/Probenzusatzwert.js --- a/app/view/grid/Probenzusatzwert.js Wed Mar 25 09:07:20 2015 +0100 +++ b/app/view/grid/Probenzusatzwert.js Wed Mar 25 15:04:45 2015 +0100 @@ -30,6 +30,7 @@ this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { clicksToMoveEditor: 1, autoCancel: false, + pluginId: 'rowedit', listeners:{ // Make row ineditable when readonly is set to true // Normally this would belong into a controller an not the view. @@ -156,5 +157,23 @@ probeId: this.recordId } }); + }, + + setReadOnly: function(b) { + if (b == true){ + //Readonly + if (this.getPlugin('rowedit')){ + this.getPlugin('rowedit').disable(); + } + this.down('button[action=delete]').disable(); + this.down('button[action=add]').disable(); + }else{ + //Writable + if (this.getPlugin('rowedit')){ + this.getPlugin('rowedit').enable(); + } + this.down('button[action=delete]').enable(); + this.down('button[action=add]').enable(); + } } }); diff -r 612f4f933083 -r 69cb367c0a63 app/view/grid/Status.js --- a/app/view/grid/Status.js Wed Mar 25 09:07:20 2015 +0100 +++ b/app/view/grid/Status.js Wed Mar 25 15:04:45 2015 +0100 @@ -26,6 +26,7 @@ this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { clicksToMoveEditor: 1, autoCancel: false, + pluginId: 'rowedit', listeners:{ // Make row ineditable when readonly is set to true // Normally this would belong into a controller an not the view. @@ -140,5 +141,23 @@ messungsId: this.recordId } }); + }, + + setReadOnly: function(b) { + if (b == true){ + //Readonly + if (this.getPlugin('rowedit')){ + this.getPlugin('rowedit').disable(); + } + this.down('button[action=delete]').disable(); + this.down('button[action=add]').disable(); + }else{ + //Writable + if (this.getPlugin('rowedit')){ + this.getPlugin('rowedit').enable(); + } + this.down('button[action=delete]').enable(); + this.down('button[action=add]').enable(); + } } }); diff -r 612f4f933083 -r 69cb367c0a63 app/view/window/ProbeEdit.js --- a/app/view/window/ProbeEdit.js Wed Mar 25 09:07:20 2015 +0100 +++ b/app/view/window/ProbeEdit.js Wed Mar 25 15:04:45 2015 +0100 @@ -53,8 +53,7 @@ autoScroll: true, items: [{ xtype: 'probeform', - recordId: this.record.get('id'), - readonly: this.record.get('readonly') + recordId: this.record.get('id') }, { xtype: 'fset', name: 'messungen', @@ -79,7 +78,7 @@ }] }, { xtype: 'fset', - name: 'probenzusaetzwerte', + name: 'probenzusatzwerte', title: 'Zusatzwerte', padding: '5, 5', margin: 5, @@ -121,6 +120,24 @@ }, scope: this }); + if (this.record.get('readonly') == true){ + this.down('probeform').setReadOnly(true); + this.disableChildren(); + } + }, + + disableChildren: function(){ + this.down('fset[name=messungen]').down('messunggrid').setReadOnly(true); + this.down('fset[name=orte]').down('ortgrid').setReadOnly(true); + this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').setReadOnly(true); + this.down('fset[name=pkommentare]').down('pkommentargrid').setReadOnly(true); + }, + + enableChildren: function(){ + this.down('fset[name=messungen]').down('messunggrid').setReadOnly(false); + this.down('fset[name=orte]').down('ortgrid').setReadOnly(false); + this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').setReadOnly(false); + this.down('fset[name=pkommentare]').down('pkommentargrid').setReadOnly(false); }, setMessages: function(errors, warnings) {