# HG changeset patch # User Dustin Demuth # Date 1432902183 -7200 # Node ID fab0b7be5acae6ec99f07e1cea994c206e548fb0 # Parent 5ed0e6273888c8c86f3647cc78e88f8ded733c5d add disbled remove button to all grids which relate to proben or messungen. Messprogramme-grids are untouched. BUG: When the last entry is deleted, the button remains active diff -r 5ed0e6273888 -r fab0b7be5aca app/view/grid/MKommentar.js --- a/app/view/grid/MKommentar.js Fri May 29 14:03:18 2015 +0200 +++ b/app/view/grid/MKommentar.js Fri May 29 14:23:03 2015 +0200 @@ -21,6 +21,8 @@ }, recordId: null, + readOnly: true, + allowDeselect: true, initComponent: function() { this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { @@ -95,8 +97,19 @@ enforceMaxLength: true } }]; + this.listeners = { + select: { + fn: this.activateRemoveButton, + scope: this + }, + deselect: { + fn: this.deactivateRemoveButton, + scope: this + } + }; this.initData(); this.callParent(arguments); + this.setReadOnly(true); //Grid is always initialised as RO }, initData: function() { @@ -126,8 +139,28 @@ if (this.getPlugin('rowedit')){ this.getPlugin('rowedit').enable(); } - this.down('button[action=delete]').enable(); + //this.down('button[action=delete]').enable(); this.down('button[action=add]').enable(); } + }, + /** + * Activate the Remove Button + */ + activateRemoveButton: function(selection, record) { + var grid = this; + //only enable the remove buttone, when the grid is editable. + if (! grid.readOnly) { + grid.down('button[action=delete]').enable(); + } + }, + /** + * Activate the Remove Button + */ + deactivateRemoveButton: function(selection, record) { + var grid = this; + //only enable the remove buttone, when the grid is editable. + if (! grid.readOnly) { + grid.down('button[action=delete]').disable(); + } } }); diff -r 5ed0e6273888 -r fab0b7be5aca app/view/grid/Messwert.js --- a/app/view/grid/Messwert.js Fri May 29 14:03:18 2015 +0200 +++ b/app/view/grid/Messwert.js Fri May 29 14:23:03 2015 +0200 @@ -27,6 +27,8 @@ margin: '0, 5, 5, 5', recordId: null, + readOnly: true, + allowDeselect: true, initComponent: function() { this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { @@ -164,8 +166,19 @@ xtype: 'checkbox' } }]; + this.listeners = { + select: { + fn: this.activateRemoveButton, + scope: this + }, + deselect: { + fn: this.deactivateRemoveButton, + scope: this + } + }; this.initData(); this.callParent(arguments); + this.setReadOnly(true); //Grid is always initialised as RO }, initData: function() { @@ -195,8 +208,28 @@ if (this.getPlugin('rowedit')){ this.getPlugin('rowedit').enable(); } - this.down('button[action=delete]').enable(); + //this.down('button[action=delete]').enable(); this.down('button[action=add]').enable(); } + }, + /** + * Activate the Remove Button + */ + activateRemoveButton: function(selection, record) { + var grid = this; + //only enable the remove buttone, when the grid is editable. + if (! grid.readOnly) { + grid.down('button[action=delete]').enable(); + } + }, + /** + * Activate the Remove Button + */ + deactivateRemoveButton: function(selection, record) { + var grid = this; + //only enable the remove buttone, when the grid is editable. + if (! grid.readOnly) { + grid.down('button[action=delete]').disable(); + } } }); diff -r 5ed0e6273888 -r fab0b7be5aca app/view/grid/Ort.js --- a/app/view/grid/Ort.js Fri May 29 14:03:18 2015 +0200 +++ b/app/view/grid/Ort.js Fri May 29 14:23:03 2015 +0200 @@ -144,7 +144,7 @@ if (this.getPlugin('rowedit')){ this.getPlugin('rowedit').enable(); } - this.down('button[action=delete]').enable(); + //this.down('button[action=delete]').enable(); this.down('button[action=add]').enable(); } }, diff -r 5ed0e6273888 -r fab0b7be5aca app/view/grid/PKommentar.js --- a/app/view/grid/PKommentar.js Fri May 29 14:03:18 2015 +0200 +++ b/app/view/grid/PKommentar.js Fri May 29 14:23:03 2015 +0200 @@ -142,7 +142,7 @@ if (this.getPlugin('rowedit')){ this.getPlugin('rowedit').enable(); } - this.down('button[action=delete]').enable(); + //this.down('button[action=delete]').enable(); this.down('button[action=add]').enable(); } }, diff -r 5ed0e6273888 -r fab0b7be5aca app/view/grid/Probenzusatzwert.js --- a/app/view/grid/Probenzusatzwert.js Fri May 29 14:03:18 2015 +0200 +++ b/app/view/grid/Probenzusatzwert.js Fri May 29 14:23:03 2015 +0200 @@ -189,7 +189,7 @@ if (this.getPlugin('rowedit')){ this.getPlugin('rowedit').enable(); } - this.down('button[action=delete]').enable(); + //this.down('button[action=delete]').enable(); this.down('button[action=add]').enable(); } }, diff -r 5ed0e6273888 -r fab0b7be5aca app/view/grid/Status.js --- a/app/view/grid/Status.js Fri May 29 14:03:18 2015 +0200 +++ b/app/view/grid/Status.js Fri May 29 14:23:03 2015 +0200 @@ -21,6 +21,8 @@ }, recordId: null, + readOnly: true, + allowDeselect: true, initComponent: function() { this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { @@ -116,8 +118,19 @@ enforceMaxLength: true } }]; + this.listeners = { + select: { + fn: this.activateRemoveButton, + scope: this + }, + deselect: { + fn: this.deactivateRemoveButton, + scope: this + } + }; this.initData(); this.callParent(arguments); + this.setReadOnly(true); //Grid is always initialised as RO }, initData: function() { @@ -147,8 +160,28 @@ if (this.getPlugin('rowedit')){ this.getPlugin('rowedit').enable(); } - this.down('button[action=delete]').enable(); + //this.down('button[action=delete]').enable(); this.down('button[action=add]').enable(); } + }, + /** + * Activate the Remove Button + */ + activateRemoveButton: function(selection, record) { + var grid = this; + //only enable the remove buttone, when the grid is editable. + if (! grid.readOnly) { + grid.down('button[action=delete]').enable(); + } + }, + /** + * Activate the Remove Button + */ + deactivateRemoveButton: function(selection, record) { + var grid = this; + //only enable the remove buttone, when the grid is editable. + if (! grid.readOnly) { + grid.down('button[action=delete]').disable(); + } } }); diff -r 5ed0e6273888 -r fab0b7be5aca app/view/window/MessungEdit.js --- a/app/view/window/MessungEdit.js Fri May 29 14:03:18 2015 +0200 +++ b/app/view/window/MessungEdit.js Fri May 29 14:23:03 2015 +0200 @@ -168,14 +168,20 @@ disableChildren: function() { this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(true); + this.down('fset[name=messwerte]').down('messwertgrid').readOnly = true; this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(true); + this.down('fset[name=messungstatus]').down('statusgrid').readOnly = true; this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(true); + this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = true; }, enableChildren: function() { this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(false); + this.down('fset[name=messwerte]').down('messwertgrid').readOnly = false; this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(false); + this.down('fset[name=messungstatus]').down('statusgrid').readOnly = false; this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(false); + this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = false; }, setMessages: function(errors, warnings) {