Skip to Content

Problem with decimal in Chrome

Hi,

i use a Edm.Decimal-Value in my oData. In Internet Explorer everything works well.

But in Chrome when i bind the Value:

<Input type="Number" value="{ path: 'Monatssumme',mode:'TwoWay',type: 'sap.ui.model.odata.type.Decimal', constraints:{ precision:6,scale:2}}" />

i got the Error:

The specified value "2,00" is not a valid number. The value must match to the following regular expression: -?(\d+|\d+\.\d+|\.\d+)([eE][-+]?\d+)?
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    May 17, 2017 at 08:49 AM

    Found the problem and the soultion...

    the problem was

    type="number"

    which is handled in an other way on chrome...so i changed my binding to the following:

    added

    formatOptions:{decimalSeparator:','}
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      3,0 isn't a number in any programming language.

      3.0

      is the way to go ;) if you need to display numbers in a different way, you should use the formatter.

      <Input type="Number" value="{ path: 'Monatssumme',mode:'TwoWay',type: 'sap.ui.model.odata.type.Decimal', constraints:{ precision:6,scale:2}, formatter: '.formatterName.methodName'}" />