问题
It looks like OData sends Edm.Decimal as "String" also containing the decimal separator.
Question: What should be send by OData? Always the same values (for example separator with ".")?
Question: How can this data be bound to SAPUI5 control with an automatic locale handling?
I am already using
new sap.ui.model.resource.ResourceModel({
But numbers are always shown with a dot as separator.
回答1:
I think there is a bug in sap.ui.model.type.Float implementation.
You can use that data type to format decimal values.
But if you try to change the value and store it back, data will be of type float. But for OData it must be a String.
Debugging the method parserValue gives me the hint:
case "string":
iResult = this.oFormat.parse(oValue);
... error handling ...
return iResult;
The iResult will not be transformed to a String if it is not already a string. You can override that method and ensure that it will return a string.
来源:https://stackoverflow.com/questions/27547654/how-to-handle-number-format-of-odata-edm-decimal-in-sapui5-correct