# HG changeset patch # User Dustin Demuth # Date 1436254654 -7200 # Node ID cf35c63053701abee520c0c11d8a72272f580bc0 # Parent dd9b77e2532bda33b899904a0a91ae14c133bd26 Added logic to autofill the Netzbetreiber when the Messstelle was selected. diff -r dd9b77e2532b -r cf35c6305370 app/controller/form/Probe.js --- a/app/controller/form/Probe.js Mon Jul 06 16:58:12 2015 +0200 +++ b/app/controller/form/Probe.js Tue Jul 07 09:37:34 2015 +0200 @@ -29,7 +29,8 @@ }, 'probeform messstelle combobox':{ expand: this.filter, - keydown: this.filter + keydown: this.filter, + select: this.setNetzbetreiber }, 'probeform [xtype="datetime"] field': { blur: this.checkDate @@ -58,6 +59,25 @@ }, /** + * When a Messtelle is selected, modify the Netzbetreiber + * according to the Messstelle + * TODO: The conditions when to apply this automatism are still + * unclear. Right now it is only applied when the NB is not set. + */ + setNetzbetreiber: function(combo, records){ + var netzbetreiber = combo.up().up('form') + .down('netzbetreiber').down('combobox'); + var nbId = records[0].get('netzbetreiberId'); + + debugger; + if (nbId != null && + (netzbetreiber.value === '' || netzbetreiber.value === null)) { + //select the NB in the NB-Combobox + netzbetreiber.select(nbId); + } + }, + + /** * The save function saves the content of the Location form. * On success it will reload the Store, * on failure, it will display an Errormessage