diff app/view/grid/Probenzusatzwert.js @ 1119:b73f9a976c82

Exponential notation without tampering numbers. Rounding is done by the server. Thus, the client should not fix the number of digits, except only for rendering.
author Tom Gottfried <tom@intevation.de>
date Mon, 23 May 2016 16:00:50 +0200
parents 7e801af49eeb
children 4f68511ce7a4
line wrap: on
line diff
--- a/app/view/grid/Probenzusatzwert.js	Mon May 23 11:39:19 2016 +0200
+++ b/app/view/grid/Probenzusatzwert.js	Mon May 23 16:00:50 2016 +0200
@@ -13,6 +13,7 @@
     extend: 'Ext.grid.Panel',
     alias: 'widget.probenzusatzwertgrid',
     requires: [
+        'Lada.view.form.ExpNumberField',
         'Lada.view.widget.Probenzusatzwert'
     ],
 
@@ -92,10 +93,13 @@
             dataIndex: 'messwertPzs',
             flex: 1,
             editor: {
-                xtype: 'textfield',
-                allowBlank: false,
-                regex: /^[+\-]?(?:(?:0|[1-9]\d*)(?:[\.\,][0-9]\d*)?(?:[eE][+\-]?\d+)|(\d+[\.\,]?\d*)?)$/,
-                regexText: 'Keine Zahl'
+                xtype: 'expnumberfield',
+            },
+            renderer: function(value) {
+                if (!value || value === '') {
+                    return value;
+                }
+                return value.toExponential(2).toString().replace('.', ',');
             }
         }, {
             header: '< NWG',
@@ -114,10 +118,13 @@
             xtype: 'numbercolumn',
             flex: 1,
             editor: {
-                xtype: 'textfield',
-                allowBlank: false,
-                regex: /^[+\-]?(?:(?:0|[1-9]\d*)(?:[\.\,][0-9]\d*)?(?:[eE][+\-]?\d+)|(\d+[\.\,]?\d*)?)$/,
-                regexText: 'Keine Zahl'
+                xtype: 'expnumberfield',
+            },
+            renderer: function(value) {
+                if (!value || value === '') {
+                    return value;
+                }
+                return value.toExponential(2).toString().replace('.', ',');
             }
         }, {
             header: 'Maßeinheit',

http://lada.wald.intevation.org