[Lada-commits] [PATCH] Clear child descriptor fields on descriptor change

Wald Commits scm-commit at wald.intevation.org
Fri Sep 11 12:20:16 CEST 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# 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 @@
         '<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 > 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;


More information about the Lada-commits mailing list