# HG changeset patch # User Dustin Demuth # Date 1427294733 -3600 # Node ID aedf0709af92dfc6c43b36378822f89827ef70c5 # Parent 14ac75f80ba10073ce34fa21b5bc98948160445b Applied ReadOnlyParadigm to a Messung Window diff -r 14ac75f80ba1 -r aedf0709af92 app/controller/form/Messung.js --- 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(); } } }); diff -r 14ac75f80ba1 -r aedf0709af92 app/view/grid/Messwert.js --- 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(); + } } }); diff -r 14ac75f80ba1 -r aedf0709af92 app/view/window/MessungEdit.js --- 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) {