Created by Wang, Jerry on Apr 29, 2016
A customer want to display amount with currency like ‘1 USD’ in table column, see below screenshot:
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);