# HG changeset patch # User Raimund Renkert # Date 1441966820 -7200 # Node ID 81e7c847cb584c26e10813b5a1407ae637d98559 # Parent 9265637fe6c03c3a98fb7f7381ccbea83ee537d4 Clear child descriptor fields on descriptor change. diff -r 9265637fe6c0 -r 81e7c847cb58 app/controller/form/Probe.js --- a/app/controller/form/Probe.js Wed Aug 26 15:29:29 2015 +0200 +++ b/app/controller/form/Probe.js Fri Sep 11 12:20:20 2015 +0200 @@ -27,7 +27,7 @@ 'probeform': { dirtychange: this.dirtyForm }, - 'probeform messstelle combobox':{ + 'probeform messstelle combobox': { expand: this.filter, keydown: this.filter, select: this.setNetzbetreiber @@ -257,15 +257,18 @@ value = records[0].get('sn'); } current[desk.layer + 1] = value; + for (var i = desk.layer + 2; i < 13; i++) { + current[i] = '00'; + } + this.clearChildDesk(desk); } media.setValue(current.join(' ').trim()); }, - clearChildDesk: function(field, media) { + clearChildDesk: function(field) { var allS = field.up('fieldset').items.items; for (var i = field.layer + 1; i < 12; i++) { allS[i].clearValue(); - media[i + 1] = '00'; } } diff -r 9265637fe6c0 -r 81e7c847cb58 app/view/widget/Deskriptor.js --- a/app/view/widget/Deskriptor.js Wed Aug 26 15:29:29 2015 +0200 +++ b/app/view/widget/Deskriptor.js Fri Sep 11 12:20:20 2015 +0200 @@ -24,7 +24,7 @@ '
' + '{sn} - {beschreibung}
'), displayTpl: Ext.create('Ext.XTemplate', - '{sn} - {beschreibung}'), + '{sn} - {beschreibung}'), listeners: { focus: { @@ -41,6 +41,12 @@ }; field.store.load(); } + else { + field.store.proxy.extraParams = { + 'layer': field.up('deskriptor').layer + }; + field.store.load(); + } } } } @@ -48,6 +54,13 @@ initComponent: function() { this.store = Ext.create('Lada.store.Deskriptoren'); + this.store.on('load', function() { + this.insert(0, {sn: 0, beschreibung: 'leer'}); + if (this.proxy.extraParams.layer > 0 && + !this.proxy.extraParams.parents) { + this.removeAll(); + } + }, this.store); this.callParent(arguments); this.down('combobox').isFormField = false;