annotate app/view/widget/Deskriptor.js @ 849:8de4ec66d0e6

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

http://lada.wald.intevation.org