comparison app/view/form/ExpNumberField.js @ 1122:49189f7b4d2f

merged.
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 23 May 2016 17:07:50 +0200
parents b73f9a976c82
children
comparison
equal deleted inserted replaced
1121:0b908138a740 1122:49189f7b4d2f
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 * Number field for display and editing of exponential numbers
11 */
12 Ext.define('Lada.view.form.ExpNumberField', {
13 extend: 'Ext.form.field.Number',
14 alias: 'widget.expnumberfield',
15
16 baseChars: '0123456789eE',
17
18 hideTrigger: true,
19 keyNavEnabled: false,
20 mouseWheelEnabled: false,
21
22 valueToRaw: function(value) {
23 if (!value || value === '') {
24 return value;
25 }
26
27 // XXX: this will be applied to any input before being sent to
28 // the server! Thus, toExponential(2) would lead to incorrectly
29 // rounded numbers at this point.
30 value = parseFloat(value).toExponential()
31 .toString().replace('.', this.decimalSeparator);
32
33 return value;
34 },
35
36 rawToValue: function(value) {
37 if (!value || value === '') {
38 return value;
39 }
40
41 value = parseFloat(
42 value.toString().replace(this.decimalSeparator, '.'));
43
44 return value;
45 }
46 });

http://lada.wald.intevation.org