diff app/view/widget/Deskriptor.js @ 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 43f3a53d07d3
children
line wrap: on
line diff
--- 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