Grid中怎么格式化时间类型数据?
解决方案
(1)使用format格式化
{
field: "updateTime",
title: "更新时间",
width: 200,
format: "{0: yyyy-MM-dd HH:mm:ss}"
}
(2)使用template实现
{
field: "updateTime",
title: "更新时间",
width: 200,
template : kendo.template($("#updatetime_template").html())
}
<script type="text/x-kendo-template" id="updatetime_template">
#= kendo.toString(updateTime, "yyyy-MM-dd HH:mm:ss") #
</script>
note:其实不止以上两种解决方案,具体可查看kendoapi文档,standardnumber format, custom number format, standard date format or a customdate format. 包含格式化number(美元符号,百分号,float类型等)和date。