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:image.pngyou 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);


相关文章
|
2月前
|
Kubernetes Unix 容器
As the default settings are now deprecated, you should set the endpoint inste
As the default settings are now deprecated, you should set the endpoint inste
|
12月前
Property ‘Authorization‘ does not exist on type ‘HeadersDefaults‘
Property ‘Authorization‘ does not exist on type ‘HeadersDefaults‘
80 0
|
5月前
|
数据库
Field ‘xxx‘ doesn‘t have a default value
Field ‘xxx‘ doesn‘t have a default value
36 0
|
5月前
|
前端开发 开发者
TS7031: Binding element ‘role‘ implicitly has an ‘any‘ type.
TS7031: Binding element ‘role‘ implicitly has an ‘any‘ type.
80 1
使用pageHelper报错 Type definition error: [simple type, classXXXX]
使用pageHelper报错 Type definition error: [simple type, classXXXX]
Warning: [antd: Form.Item] `defaultValue` will not work on controlled Field. You should use `initialValues` of Form instead.
Warning: [antd: Form.Item] `defaultValue` will not work on controlled Field. You should use `initialValues` of Form instead.
691 0
No injector for custom defined data type的解决办法
No injector for custom defined data type的解决办法
245 0
No injector for custom defined data type的解决办法
How to change the default S2.view.xml load logic
Created by Jerry Wang, last modified on Mar 24, 2015
How to change the default S2.view.xml load logic
How is target My note application rendered - renderManager
Created by Wang, Jerry, last modified on May 18, 2015
116 0
How is target My note application rendered - renderManager