comparison app/view/grid/Probenzusatzwert.js @ 1123:4f68511ce7a4

Restrict range of values to two-digit exponent and format it nicely.
author Tom Gottfried <tom@intevation.de>
date Mon, 23 May 2016 17:50:47 +0200
parents b73f9a976c82
children 5941ee0c7247
comparison
equal deleted inserted replaced
1122:49189f7b4d2f 1123:4f68511ce7a4
92 header: 'Messwert', 92 header: 'Messwert',
93 dataIndex: 'messwertPzs', 93 dataIndex: 'messwertPzs',
94 flex: 1, 94 flex: 1,
95 editor: { 95 editor: {
96 xtype: 'expnumberfield', 96 xtype: 'expnumberfield',
97 maxValue: 9.99e+99,
98 minValue: 1e-99
97 }, 99 },
98 renderer: function(value) { 100 renderer: function(value) {
99 if (!value || value === '') { 101 if (!value || value === '') {
100 return value; 102 return value;
101 } 103 }
102 return value.toExponential(2).toString().replace('.', ','); 104 var strValue = value.toExponential(2).toString()
105 .replace('.', Ext.util.Format.decimalSeparator);
106 var splitted = strValue.split('e');
107 var exponent = parseInt(splitted[1]);
108 return splitted[0] + 'e'
109 + ((exponent < 0) ? '-' : '+')
110 + ((Math.abs(exponent) < 10) ? '0' : '')
111 + Math.abs(exponent).toString();
103 } 112 }
104 }, { 113 }, {
105 header: '< NWG', 114 header: '< NWG',
106 flex: 1, 115 flex: 1,
107 renderer: function(value, meta, record) { 116 renderer: function(value, meta, record) {
117 dataIndex: 'nwgZuMesswert', 126 dataIndex: 'nwgZuMesswert',
118 xtype: 'numbercolumn', 127 xtype: 'numbercolumn',
119 flex: 1, 128 flex: 1,
120 editor: { 129 editor: {
121 xtype: 'expnumberfield', 130 xtype: 'expnumberfield',
131 maxValue: 9.99e+99,
132 minValue: 1e-99
122 }, 133 },
123 renderer: function(value) { 134 renderer: function(value) {
124 if (!value || value === '') { 135 if (!value || value === '') {
125 return value; 136 return value;
126 } 137 }
127 return value.toExponential(2).toString().replace('.', ','); 138 var strValue = value.toExponential(2).toString()
139 .replace('.', Ext.util.Format.decimalSeparator);
140 var splitted = strValue.split('e');
141 var exponent = parseInt(splitted[1]);
142 return splitted[0] + 'e'
143 + ((exponent < 0) ? '-' : '+')
144 + ((Math.abs(exponent) < 10) ? '0' : '')
145 + Math.abs(exponent).toString();
128 } 146 }
129 }, { 147 }, {
130 header: 'Maßeinheit', 148 header: 'Maßeinheit',
131 dataIndex: 'pzsId', 149 dataIndex: 'pzsId',
132 flex: 1, 150 flex: 1,

http://lada.wald.intevation.org