With neary each version of SAPUI5 I have strange problems with the sap.ui.model.type.Float
data type in combination with an ODataModel.
See my old post: How to handle number format of OData Edm.Decimal in sapui5 correct?
Later I build a hack to solve the problem (SAPUI5 1.26.x) that worked and looked like mentioned here: https://stackoverflow.com/a/27147305/3783327
This was well working. Now I try to upgrade to 1.28.12 and to the sap.ui.model.odata.v2.ODataModel
model.
I have the following situation:
- Edm.Decimal on server sending decimals in English locale (seperator is a .)
- Frontend should handle user language but at least German
I bind the control with the usage of the following type:
return new sap.ui.model.type.Float({
maxFractionDigits : 2,
minFractionDigits: 2,
source : {
maxFractionDigits : 2,
minFractionDigits: 2
}
});
According to the documentation the source
is used to define the model format.
If I use it as posted the post will have a comma as seperator instead of a dot.
If I don't use it, the model will receive a float instead of a string (same problem as with 1.26.x).
What is the correct solution to bind a Edm.Decimal
with the Float
datatype so that I can enter the number in the user locale of the browser and it will always be send correct to the server?