Mercurial > lada > lada-client
diff app/controller/form/Messprogramm.js @ 787:442e7bd290dc
merged heads
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Wed, 13 May 2015 10:27:15 +0200 |
parents | f0b26df02157 |
children | b8fd43021c29 |
line wrap: on
line diff
--- a/app/controller/form/Messprogramm.js Wed May 13 09:33:58 2015 +0200 +++ b/app/controller/form/Messprogramm.js Wed May 13 10:27:15 2015 +0200 @@ -39,6 +39,9 @@ }, 'messprogrammform probenintervall combobox': { select: this.updateIntervalls + }, + 'messprogrammform panel[xtype="deskriptor] combobox': { + select: this.deskriptorSelect } }); }, @@ -231,4 +234,51 @@ field.up('fieldset').clearMessages(); } } - }}); + }, + + deskriptorSelect: function(field, records) { + var desk = field.up('deskriptor'); + var media = field.up('messprogrammform').down('textfield[name="mediaDesk"]'); + var current = media.getValue().split(' '); + this.clearChildDesk(field.up('deskriptor'), current); + if (current.length < 13) { + for (var i = 0; i <= 12; i++) { + if (i === 0) { + current.push('D:'); + } + else if (i === desk.layer + 1) { + var value; + if (records[0].get('sn') < 10) { + value = '0' + records[0].get('sn'); + } + else { + value = records[0].get('sn'); + } + current.push(value); + } + else { + current.push('00'); + } + } + } + else { + var value; + if (records[0].get('sn') < 10) { + value = '0' + records[0].get('sn'); + } + else { + value = records[0].get('sn'); + } + current[desk.layer + 1] = value; + } + media.setValue(current.join(' ').trim()); + }, + + clearChildDesk: function(field, media) { + var allS = field.up('fieldset').items.items; + for (var i = field.layer + 1; i < 12; i++) { + allS[i].clearValue(); + media[i + 1] = '00'; + } + } +});