Mercurial > lada > lada-client
annotate app/view/widget/Deskriptor.js @ 889:81fc61545638
Moved Ext-Version from debug -> normal
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Thu, 23 Jul 2015 16:40:28 +0200 |
parents | 43f3a53d07d3 |
children | 81e7c847cb58 |
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', |
850
43f3a53d07d3
Added templates to deskriptor cbs to display the sn number and a text.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
849
diff
changeset
|
15 displayField: 'id', |
770
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, |
850
43f3a53d07d3
Added templates to deskriptor cbs to display the sn number and a text.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
849
diff
changeset
|
23 tpl: Ext.create('Ext.XTemplate', |
43f3a53d07d3
Added templates to deskriptor cbs to display the sn number and a text.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
849
diff
changeset
|
24 '<tpl for="."><div class="x-combo-list-item x-boundlist-item" >' + |
43f3a53d07d3
Added templates to deskriptor cbs to display the sn number and a text.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
849
diff
changeset
|
25 '{sn} - {beschreibung}</div></tpl>'), |
43f3a53d07d3
Added templates to deskriptor cbs to display the sn number and a text.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
849
diff
changeset
|
26 displayTpl: Ext.create('Ext.XTemplate', |
43f3a53d07d3
Added templates to deskriptor cbs to display the sn number and a text.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
849
diff
changeset
|
27 '<tpl for=".">{sn} - {beschreibung}</tpl>'), |
849
8de4ec66d0e6
Fixed expanding.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
783
diff
changeset
|
28 |
770
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 listeners: { |
849
8de4ec66d0e6
Fixed expanding.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
783
diff
changeset
|
30 focus: { |
770
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 fn: function(field) { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 if (field.up('deskriptor').layer === 0) { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 field.store.proxy.extraParams = {'layer': field.up('deskriptor').layer}; |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 } |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 else { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 var parents = field.up('deskriptor').getParents(this); |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 if (parents !== '') { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 field.store.proxy.extraParams = { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 'layer': field.up('deskriptor').layer, |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 'parents': parents |
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 field.store.load(); |
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 } |
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 } |
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 initComponent: function() { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 this.store = Ext.create('Lada.store.Deskriptoren'); |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 this.callParent(arguments); |
783
afdbe3770b99
Exclude deskriptor fields from form.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
770
diff
changeset
|
53 this.down('combobox').isFormField = false; |
770
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 }, |
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 getParents: function(field) { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 var set = field.up('fieldset'); |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 var allS = set.items.items; |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 var p = ''; |
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 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
|
62 if (allS[i].getValue() > 0) { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 p += allS[i].getValue(); |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 if (i < field.up('deskriptor').layer - 1) { |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 p += ', '; |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 } |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 } |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 } |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 return p; |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 } |
3185a77e8501
Added combobox widget for deskriptoren.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 }); |