Mercurial > lada > lada-client
comparison app/view/widget/Deskriptor.js @ 770:3185a77e8501
Added combobox widget for deskriptoren.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 12 May 2015 15:11:15 +0200 |
parents | |
children | afdbe3770b99 |
comparison
equal
deleted
inserted
replaced
769:274a843caf44 | 770:3185a77e8501 |
---|---|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz | |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out | |
6 * the documentation coming with IMIS-Labordaten-Application for details. | |
7 */ | |
8 | |
9 /** | |
10 * Combobox for Deskriptor | |
11 */ | |
12 Ext.define('Lada.view.widget.Deskriptor', { | |
13 extend: 'Lada.view.widget.base.ComboBox', | |
14 alias: 'widget.deskriptor', | |
15 displayField: 'beschreibung', | |
16 valueField: 'id', | |
17 // Enable filtering of comboboxes | |
18 triggerAction: 'all', | |
19 typeAhead: false, | |
20 layer: null, | |
21 queryMode: 'local', | |
22 listeners: { | |
23 expand: { | |
24 fn: function(field) { | |
25 if (field.up('deskriptor').layer === 0) { | |
26 field.store.proxy.extraParams = {'layer': field.up('deskriptor').layer}; | |
27 field.store.load(); | |
28 } | |
29 else { | |
30 var parents = field.up('deskriptor').getParents(this); | |
31 if (parents !== '') { | |
32 field.store.proxy.extraParams = { | |
33 'layer': field.up('deskriptor').layer, | |
34 'parents': parents | |
35 }; | |
36 field.store.load(); | |
37 } | |
38 } | |
39 } | |
40 } | |
41 }, | |
42 | |
43 initComponent: function() { | |
44 this.store = Ext.create('Lada.store.Deskriptoren'); | |
45 | |
46 this.callParent(arguments); | |
47 }, | |
48 | |
49 getParents: function(field) { | |
50 var set = field.up('fieldset'); | |
51 var allS = set.items.items; | |
52 var p = ''; | |
53 | |
54 for (var i = 0; i < field.up('deskriptor').layer; i++) { | |
55 if (allS[i].getValue() > 0) { | |
56 p += allS[i].getValue(); | |
57 if (i < field.up('deskriptor').layer - 1) { | |
58 p += ', '; | |
59 } | |
60 } | |
61 } | |
62 return p; | |
63 } | |
64 }); |