简体   繁体   English

表达式绑定到格式编号值

[英]Expression Binding to format number values

our oData is returning the below value. 我们的oData返回以下值。

"this is test 870.00 and 250.00" “这是测试870.00和250.00”

Our requirement is to remove the decimals from the string during the run time of the app on the View. 我们的要求是在View上应用程序的运行期间从字符串中删除小数。 Below is my binding. 以下是我的绑定。

<Text text="{path:'oTesTableModel>score',formatter:'publicservices.scr.myscorereq.util.Formatter.score'}"/>

can some one suggest if we can use expression binding to remove the decimals from the string and if yes can please provide some example. 有人可以建议我们是否可以使用表达式绑定从字符串中删除小数点,如果可以,请提供一些示例。

Thanks 谢谢

You can make use of the in built Number Formatter. 您可以使用内置的Number Formatter。

<Text text="{path:'oTesTableModel>score',type:'sap.ui.model.type.Integer'}"/>

https://sapui5.hana.ondemand.com/1.40.9/explored.html#/sample/sap.ui.core.sample.TypeInteger/preview https://sapui5.hana.ondemand.com/1.40.9/explored.html#/sample/sap.ui.core.sample.TypeInteger/preview

尝试这个

<Text text="{= Math.floor(${oTesTableModel>score}) }"></Text>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM