首页 > 其他 > 详细

Kendo UI:Grid中单元格日期格式化

时间:2017-04-27 18:35:49      阅读:2460      评论:0      收藏:0      [点我收藏+]

摘自: http://blog.csdn.net/sun_jy2011/article/details/41546337

 

Kendo UI: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>  

  

以上两种方法都可以实现。但存在一个问题,必须把数据类型设置为date类型

            dataSource: {
                pageSize: 20,
                transport: {
                    read: {
                        contentType: "application/json",
                        dataType: "json",
                        type: "Post",
                        url: "URL"
                    }
                },
                schema: {
                    data: "rows",
                    total: "total",
                    model: {
                        id: "ID",
                        fields: {
                            updateTime: { type: "date" }
                        }
                    }
                }
            }

  

 

Kendo UI:Grid中单元格日期格式化

原文:http://www.cnblogs.com/fanjf/p/6775459.html

(0)
(4)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!