changeset 925:81e7c847cb58

Clear child descriptor fields on descriptor change.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 11 Sep 2015 12:20:20 +0200
parents 9265637fe6c0
children c75f13578315
files app/controller/form/Probe.js app/view/widget/Deskriptor.js
diffstat 2 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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';
         }
     }
 
--- 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 @@
         '<tpl for="."><div class="x-combo-list-item  x-boundlist-item" >' +
             '{sn} - {beschreibung}</div></tpl>'),
     displayTpl: Ext.create('Ext.XTemplate',
-         '<tpl for=".">{sn} - {beschreibung}</tpl>'),
+         '<tpl for="."><tpl if="sn &gt; 0">{sn} - {beschreibung}</tpl></tpl>'),
 
     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;

http://lada.wald.intevation.org