0
如果Begda已設置,我想顯示「 - 」,否則只顯示「」。當Begda設置時,輸出顯示「NaN」,否則顯示正確的類型。所以三元運算符工作,但格式化程序不起作用。該Begda字段包含實際日期對象:我的列表項目模板有什麼問題?
this._oSelectedTrainingsModel.getData()[0].Begda
15:31:37.916 Date 2016-09-17T00:00:00.000Z
var oItemTemplate = new sap.m.StandardListItem({
title: "{Title}",
description: "{= ${Begda} ? ${Type} - ${ path: 'Begda', type: 'sap.ui.model.type.Date', formatOptions: { style: 'medium' }} : ${Type} }",
icon: "{icon}",
iconInset: false
});
我也以同樣「男」輸出試過這樣:
var oItemTemplate = new sap.m.StandardListItem({
title: "{Title}",
description: "{= ${Begda} ? ${Type} - ${Begda}.toLocaleDateString() : ${Type} }",
icon: "{icon}",
iconInset: false
});