我得到了这个表达式绑定:
<Text text="{
parts: [
{path: 'amount'},
{path: 'currency'}
],
type: 'sap.ui.model.type.Currency',
formatOptions: {showMeasure: false}
}"/>现在我想在我的表中显示它之前,我想将金额除以100,是否可以在不使用自己的格式化程序的情况下这样做?
发布于 2016-07-05 01:14:35
抱歉,无法将表达式绑定与类型结合使用。这些类型已经内置了一个格式化程序,这意味着您将对同一个值使用两个格式化程序。
如果要将数量除以100,最简单的方法是只继承Currency类型,然后将除法添加到方法formatValue的覆盖中。
发布于 2016-07-05 14:40:51
这可以通过自定义格式化程序功能来实现。我正在用JavaScript编写它。我希望你能理解。
有关更多信息,请访问:Custom Formatter Functions
oTxt.bindValue({
parts: [
{path: 'amount'},
{path: 'currency'}
],
formatter: function(amount, currency){
if (amount && currency) {
var calculatedAmount = amount/100;
return currency+calculatedAmount;
} else {
return null;
}
}
}); https://stackoverflow.com/questions/38183973
复制相似问题