![](/img/trans.png)
[英]Javascript regular expression to capture every possible mathematical operation between parenthesis
[英]Mathematical operation expression binding
我得到此表達式綁定:
<Text text="{
parts: [
{path: 'amount'},
{path: 'currency'}
],
type: 'sap.ui.model.type.Currency',
formatOptions: {showMeasure: false}
}"/>
現在我想在將其顯示在表中之前將其除以100,那有可能在不使用自己的格式化程序的情況下做到這一點嗎?
抱歉,無法將表達式綁定與類型結合使用。 這些類型已經內置了格式化程序,這意味着您將對相同的值使用兩個格式化程序。
如果要將金額除以100,則最簡單的方法是僅將Currency
類型子類化,然后將除法添加到方法formatValue
的替代中。
通過自定義格式化程序功能可以實現。 我用JavaScript編寫。 我希望你能夠明白。
有關更多信息,請參見: 自定義格式化程序功能
oTxt.bindValue({
parts: [
{path: 'amount'},
{path: 'currency'}
],
formatter: function(amount, currency){
if (amount && currency) {
var calculatedAmount = amount/100;
return currency+calculatedAmount;
} else {
return null;
}
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.