annotate app/view/widget/Netzbetreiber.js @ 1427:c22581d48040

In case a value is shown, separate it with a space.
author Tom Gottfried <tom@intevation.de>
date Thu, 06 Apr 2017 16:17:20 +0200
parents 4270da0f7d3b
children
rev   line source
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /**
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * Combobox for Netzbetreiber
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.widget.Netzbetreiber', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Lada.view.widget.base.ComboBox',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.netzbetreiber',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 store: 'StaNetzbetreiber',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 displayField: 'netzbetreiber',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 valueField: 'id',
1125
f5cc079cd683 Allow Netzbetreiber widget to be not editable.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1080
diff changeset
18 editable: this.editable || false,
847
95d40ca7bb70 Netbetreiber Combobox shall be readonly
Dustin Demuth <dustin@intevation.de>
parents: 830
diff changeset
19 readOnly: this.readOnly,
1217
4270da0f7d3b Merged branch schema-update into default.
Tom Gottfried <tom@intevation.de>
parents: 1151
diff changeset
20 isFormField: this.isFormField,
4270da0f7d3b Merged branch schema-update into default.
Tom Gottfried <tom@intevation.de>
parents: 1151
diff changeset
21 submitValue: this.submitValue,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 // Enable filtering of comboboxes
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 queryMode: 'local',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 triggerAction: 'all',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 typeAhead: false,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 minChars: 0,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 initComponent: function() {
755
3637c453f67d Enabled Creation of a Messprogramm, an empty Window is now shown. The save operation leads to a E 500
Dustin Demuth <dustin@intevation.de>
parents: 740
diff changeset
29 var i18n = Lada.getApplication().bundle;
830
60b15e3983a6 Emptytext wurde falsch gesetzt
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
30 this.emptyText = i18n.getMsg('emptytext.netzbetreiber');
755
3637c453f67d Enabled Creation of a Messprogramm, an empty Window is now shown. The save operation leads to a E 500
Dustin Demuth <dustin@intevation.de>
parents: 740
diff changeset
31
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 this.store = Ext.data.StoreManager.get('netzbetreiber');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 if (!this.store) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 this.store = Ext.create('Lada.store.Netzbetreiber');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 }
740
2e8da590ea0c made Comboboces editable and filterable for; Messungenform: Messstelle,Datenbasis,Betriebsarts,Testdatensatz,Preobenart,Netzbetreiber Messungform: Messmethode Messwertegrid: Messgroesse,Messeinheit
Dustin Demuth <dustin@intevation.de>
parents: 548
diff changeset
36 else {
2e8da590ea0c made Comboboces editable and filterable for; Messungenform: Messstelle,Datenbasis,Betriebsarts,Testdatensatz,Preobenart,Netzbetreiber Messungform: Messmethode Messwertegrid: Messgroesse,Messeinheit
Dustin Demuth <dustin@intevation.de>
parents: 548
diff changeset
37 this.store.clearFilter();
2e8da590ea0c made Comboboces editable and filterable for; Messungenform: Messstelle,Datenbasis,Betriebsarts,Testdatensatz,Preobenart,Netzbetreiber Messungform: Messmethode Messwertegrid: Messgroesse,Messeinheit
Dustin Demuth <dustin@intevation.de>
parents: 548
diff changeset
38 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 this.callParent(arguments);
1217
4270da0f7d3b Merged branch schema-update into default.
Tom Gottfried <tom@intevation.de>
parents: 1151
diff changeset
40 this.down('combobox').isFormField = false;
4270da0f7d3b Merged branch schema-update into default.
Tom Gottfried <tom@intevation.de>
parents: 1151
diff changeset
41 this.down('combobox').submitValue = false;
1080
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
42 },
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
43
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
44 getValue: function() {
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
45 var value = this.down('combobox').getValue();
1151
356941a04ba0 Fixed Type error in netzbetreiber widget.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1125
diff changeset
46 if (value === undefined || value === null || value === '') {
356941a04ba0 Fixed Type error in netzbetreiber widget.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1125
diff changeset
47 return [];
356941a04ba0 Fixed Type error in netzbetreiber widget.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1125
diff changeset
48 }
1080
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
49 if (value instanceof Array) {
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
50 return value;
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
51 }
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
52 value = value.trim().split(' ');
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
53 var retValues = [];
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
54 for (var i = 0; i < value.length; i++) {
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
55 var item = value[i];
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
56 var found = this.store.queryBy(function(rec) {
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
57 if (rec.get('id') == item ||
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
58 rec.get('netzbetreiber') == item) {
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
59 return true;
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
60 }
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
61 });
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
62 if (found.getCount() >= 0) {
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
63 retValues.push(found.getAt(0).get('id'));
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
64 continue;
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
65 }
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
66 }
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
67 return retValues;
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 });

http://lada.wald.intevation.org