How to bind multiple properties with formatter on one control
生活随笔
收集整理的這篇文章主要介紹了
How to bind multiple properties with formatter on one control
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Issue description:
A customer want to display amount with currency like ‘1 USD’ in table column, see below screenshot:
[外鏈圖片轉存失敗(img-SwLswYGO-1566606739715)(https://user-images.githubusercontent.com/5669954/59319475-6cb61e80-8cfd-11e9-8c54-670884799d2b.png)]
you can ref to the following example to bind two properties in one control:
var sAmount = "ReportTableData>ExpectedSalesVolumne_Cy"; var sUnit = "ReportTableData>Unit"; var oFieldTemplate = new sap.m.Label().bindProperty("text",{ parts: [{path: sAmount }, {path: sUnit } ],formatter: function(sNum, sUnit){var sNumber = sNum ? sap.ca.ui.model.format.AmountFormat.FormatAmountStandard(sNum, null, 0) : 0; return sNumber + " " + sUnit; } });var oColumnTemplate = new sap.ui.table.Column({ hAlign: "Right", label: new sap.m.Label({text: "Expected Sales Volumne (Weighted)"}), width: "130px", sortProperty: "ExpectedSalesVolumne_Cy", template: oFieldTemplate });oTable.addColumn(oColumnTemplate);要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
總結
以上是生活随笔為你收集整理的How to bind multiple properties with formatter on one control的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: js延迟2秒执行事件
- 下一篇: 三种最典型的大数据存储技术路线