Mercurial > lada > lada-client
changeset 1419:01f083db45b7
Use readonly flag to set edit status of UI
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 29 Mar 2017 14:27:20 +0200 |
parents | 3ecf993c250a |
children | 48c9c7b0ceef |
files | app/controller/grid/Messmethode.js app/model/Messprogramm.js app/view/form/Messprogramm.js app/view/widget/DayOfYear.js app/view/widget/DynamicGrid.js app/view/window/Messprogramm.js |
diffstat | 6 files changed, 32 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controller/grid/Messmethode.js Wed Mar 29 08:49:56 2017 +0200 +++ b/app/controller/grid/Messmethode.js Wed Mar 29 14:27:20 2017 +0200 @@ -143,8 +143,8 @@ //Set Store ngrid.setData(mmtmessgroessenstore); - //Enable Editing - ngrid.setReadOnly(false); + //Enable Editing depending on the readonly state of the messprogramm. + ngrid.setReadOnly(row.view.up('window').record.get('readonly')); }, /**
--- a/app/model/Messprogramm.js Wed Mar 29 08:49:56 2017 +0200 +++ b/app/model/Messprogramm.js Wed Mar 29 14:27:20 2017 +0200 @@ -78,6 +78,10 @@ }, { name: 'media', persist: false + }, { + name: 'readonly', + type: 'boolean', + persist: false }], idProperty: 'id',
--- a/app/view/form/Messprogramm.js Wed Mar 29 08:49:56 2017 +0200 +++ b/app/view/form/Messprogramm.js Wed Mar 29 14:27:20 2017 +0200 @@ -665,7 +665,25 @@ }, setReadOnly: function(value) { - // TODO + this.down('cbox[name=mstlabor]').setReadOnly(value); + this.down('cbox[name=datenbasisId]').setReadOnly(value); + this.down('cbox[name=baId]').setReadOnly(value); + this.down('chkbox[name=test]').setReadOnly(value); + this.down('cbox[name=probenartId]').setReadOnly(value); + this.down('netzbetreiber').setReadOnly(value); + this.down('cbox[name=probenintervall]').setReadOnly(value); + this.down('numfield[name=teilintervallVon]').setReadOnly(value); + this.down('numfield[name=teilintervallBis]').setReadOnly(value); + this.down('numfield[name=intervallOffset]').setReadOnly(value); + this.down('dayofyear[name=gueltigVon]').setReadOnly(value); + this.down('dayofyear[name=gueltigBis]').setReadOnly(value); + this.down('cbox[name=umwId]').setReadOnly(value); + this.down('cbox[name=probeNehmerId]').setReadOnly(value); + this.down('messprogrammland[name=mplId]').setReadOnly(value); + this.down('probenintervallslider').setReadOnly(value); + for (var i = 0; i < 12; i++) { + this.down('deskriptor[layer='+i+']').setReadOnly(value); + } }, buildDescriptors: function() {
--- a/app/view/widget/DayOfYear.js Wed Mar 29 08:49:56 2017 +0200 +++ b/app/view/widget/DayOfYear.js Wed Mar 29 14:27:20 2017 +0200 @@ -269,5 +269,10 @@ setValue: function(value) { this.down('numberfield[hidden]').setValue(value); + }, + + setReadOnly: function(value) { + this.down('numberfield[hidden=false]').setReadOnly(value); + this.down('combobox').setReadOnly(value); } });
--- a/app/view/widget/DynamicGrid.js Wed Mar 29 08:49:56 2017 +0200 +++ b/app/view/widget/DynamicGrid.js Wed Mar 29 14:27:20 2017 +0200 @@ -106,7 +106,7 @@ width: 30, getClass: function (val, meta, rec) { if (rec.get('readonly') === false && - rec.get('owner') === true && + (rec.get('owner') === true || rec.get('owner') === '') && !rec.get('statusEdit')) { return 'edit'; }
--- a/app/view/window/Messprogramm.js Wed Mar 29 08:49:56 2017 +0200 +++ b/app/view/window/Messprogramm.js Wed Mar 29 14:27:20 2017 +0200 @@ -147,7 +147,6 @@ // create a Edit window if (this.record) { this.setLoading(true); - this.down('messmethodengrid').setReadOnly(false); Ext.ClassManager.get('Lada.model.Messprogramm').load(this.record.get('id'), { failure: function(record, action) { me.setLoading(false); @@ -201,6 +200,7 @@ disableChildren: function() { this.down('fset[name=orte]').down('ortszuordnunggrid').setReadOnly(true); + this.down('messmethodengrid').setReadOnly(true); }, enableChildren: function() {