您的位置:首页 > 产品设计 > UI/UE

sapui5中的formatter和Table数据显示 有一则例子

2017-03-24 13:11 369 查看
Table中formatter的使用两个例子:

new sap.m.Text({ text: {path: 'CKDATE',
formatter: function(sDate) {
var fDate = sDate.split(" ");
fDate = fDate[0].split("-");
s = fDate[0] + "年" + parseInt(fDate[1]) + "月" + parseInt(fDate[2]) + "日";
mymodules.Module1.debug("new date is " + s);
return s;
}
}
}),
new sap.m.Text({ text: {path: 'JCDATE',
formatter: 'mymodules.Module1.stringToDate'
}
})


Module1.js增加一个formatter方法:

/* 字符串转时间(yyyy-MM-dd HH:mm:ss) */
/* 转字符串 "2006年3月4日“ */
stringToDate : function(sDate){
//alert("stringToDate called begin");
var fDate = sDate.split(" ");
fDate = fDate[0].split("-");
s = fDate[0] + "年" + parseInt(fDate[1]) + "月" + parseInt(fDate[2]) + "日";
mymodules.Module1.debug("new date is " + s);
return s;
},
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: