[Lada-commits] [PATCH 2 of 3] Added combobox widget for deskriptoren

Wald Commits scm-commit at wald.intevation.org
Tue May 12 15:12:13 CEST 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1431436275 -7200
# Node ID 3185a77e8501235bf3430b0eacc27af497195f2d
# Parent  274a843caf44122aa57ab6067e4235cbaa8dccea
Added combobox widget for deskriptoren.

diff -r 274a843caf44 -r 3185a77e8501 app/view/widget/Deskriptor.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/widget/Deskriptor.js	Tue May 12 15:11:15 2015 +0200
@@ -0,0 +1,64 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out
+ * the documentation coming with IMIS-Labordaten-Application for details.
+ */
+
+/**
+ * Combobox for Deskriptor
+ */
+Ext.define('Lada.view.widget.Deskriptor', {
+    extend: 'Lada.view.widget.base.ComboBox',
+    alias: 'widget.deskriptor',
+    displayField: 'beschreibung',
+    valueField: 'id',
+    // Enable filtering of comboboxes
+    triggerAction: 'all',
+    typeAhead: false,
+    layer: null,
+    queryMode: 'local',
+    listeners: {
+        expand: {
+            fn: function(field) {
+                if (field.up('deskriptor').layer === 0) {
+                    field.store.proxy.extraParams = {'layer': field.up('deskriptor').layer};
+                    field.store.load();
+                }
+                else {
+                    var parents = field.up('deskriptor').getParents(this);
+                    if (parents !== '') {
+                        field.store.proxy.extraParams = {
+                            'layer': field.up('deskriptor').layer,
+                            'parents': parents
+                        };
+                        field.store.load();
+                    }
+                }
+            }
+        }
+    },
+
+    initComponent: function() {
+        this.store = Ext.create('Lada.store.Deskriptoren');
+
+        this.callParent(arguments);
+    },
+
+    getParents: function(field) {
+        var set = field.up('fieldset');
+        var allS = set.items.items;
+        var p = '';
+
+        for (var i = 0; i < field.up('deskriptor').layer; i++) {
+            if (allS[i].getValue() > 0) {
+                p += allS[i].getValue();
+                if (i < field.up('deskriptor').layer - 1) {
+                    p += ', ';
+                }
+            }
+        }
+        return p;
+    }
+});


More information about the Lada-commits mailing list