Mercurial > lada > lada-client
annotate app/view/widget/Deskriptor.js @ 782:a0cfe2395e0a
Added Prototype for Date to return DOY
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Tue, 12 May 2015 17:49:09 +0200 |
parents | 3185a77e8501 |
children | afdbe3770b99 |
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, |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 queryMode: 'local', |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 listeners: { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 expand: { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 fn: function(field) { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 if (field.up('deskriptor').layer === 0) { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 field.store.proxy.extraParams = {'layer': field.up('deskriptor').layer}; |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 field.store.load(); |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 } |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 else { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 var parents = field.up('deskriptor').getParents(this); |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 if (parents !== '') { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 field.store.proxy.extraParams = { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 'layer': field.up('deskriptor').layer, |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 'parents': parents |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 }; |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 field.store.load(); |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 } |
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 initComponent: function() { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 this.store = Ext.create('Lada.store.Deskriptoren'); |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 this.callParent(arguments); |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 }, |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 getParents: function(field) { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 var set = field.up('fieldset'); |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 var allS = set.items.items; |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 var p = ''; |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 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
|
55 if (allS[i].getValue() > 0) { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 p += allS[i].getValue(); |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 if (i < field.up('deskriptor').layer - 1) { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 p += ', '; |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 } |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 } |
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 return p; |
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 }); |