Mercurial > lada > lada-client
changeset 687:aedf0709af92
Applied ReadOnlyParadigm to a Messung Window
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Wed, 25 Mar 2015 15:45:33 +0100 |
parents | 14ac75f80ba1 |
children | 6a6d1b02a1a3 |
files | app/controller/form/Messung.js app/view/grid/Messwert.js app/view/window/MessungEdit.js |
diffstat | 3 files changed, 25 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controller/form/Messung.js Wed Mar 25 15:20:45 2015 +0100 +++ b/app/controller/form/Messung.js Wed Mar 25 15:45:33 2015 +0100 @@ -73,10 +73,12 @@ if (dirty) { form.owner.down('button[action=save]').setDisabled(false); form.owner.down('button[action=discard]').setDisabled(false); + form.owner.up('window').disableChildren(); } else { form.owner.down('button[action=save]').setDisabled(true); form.owner.down('button[action=discard]').setDisabled(true); + form.owner.up('window').enableChildren(); } } });
--- a/app/view/grid/Messwert.js Wed Mar 25 15:20:45 2015 +0100 +++ b/app/view/grid/Messwert.js Wed Mar 25 15:45:33 2015 +0100 @@ -176,6 +176,11 @@ 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(); + } } });
--- a/app/view/window/MessungEdit.js Wed Mar 25 15:20:45 2015 +0100 +++ b/app/view/window/MessungEdit.js Wed Mar 25 15:45:33 2015 +0100 @@ -103,6 +103,23 @@ }, scope: this }); + + if (this.record.get('readonly') == true){ + this.down('messungform').setReadOnly(true); + this.disableChildren(); + } + }, + + disableChildren: function(){ + this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(true); + this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(true); + this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(true); + }, + + enableChildren: function(){ + this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(false); + this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(false); + this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(false); }, setMessages: function(errors, warnings) {