我在SAPDB中有一个整数但由于某种原因它必须存储为NUMERIC,并且数值在SAP DB中存储为字符串.
因此OData服务返回0000000001
而不是1
.
那么问题是如何在XML视图中删除前导零.问题是我使用XML View时无法使用Javascript进行格式化.
我找到的唯一解决方案是使用这样的代码:
但我不知道为什么它没有删除前导零,而在其参考文献中已经说过:
if true, the value is handled as a sequence of digits; while formatting leading zeros are removed from the value and while parsing the value is enhanced with leading zeros (if a maxLength constraint is given) or leading zeros are removed from the value (if no maxLength constraint is given); this constraint is supported since 1.35.0. To make this type behave as ABAP type NUMC, use oConstraints.isDigitSequence=true together with oConstraints.maxLength.
我发现一些相关数据的参考文献在以下链接中:
https://archive.sap.com/discussions/thread/3681816
https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.odata.type.String.html
https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.model.type.Integer.html
https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.core.format.NumberFormat.html
您既没有使用正确的类型实现,也没有使用正确的绑定语法来设置约束.请查看文档: