Kendo网格日期列不格式化 [英] Kendo grid date column not formatting
本文介绍了Kendo网格日期列不格式化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 KendoGrid
,如下所示,当我运行应用程序时,我没有得到 date
列。
I have a KendoGrid
like below and when I run the application, I'm not getting the expected format for date
column.
$("#empGrid").kendoGrid({
dataSource: {
data: empModel.Value,
pageSize: 10
},
columns: [
{
field: "Name",
width: 90,
title: "Name"
},
{
field: "DOJ",
width: 90,
title: "DOJ",
type: "date",
format:"{0:MM-dd-yyyy}"
}
]
});
当我运行这个,我得到 2013-07-02T00 :00:00Z
在DOJ栏中。为什么不是格式?任何想法?
When I run this, I'm getting "2013-07-02T00:00:00Z
" in DOJ column. Why it is not formatting? Any idea?
推荐答案
我发现这条信息,使其正常工作。给我的数据是字符串格式,所以我需要使用 kendo.parseDate
在使用 kendo.toString $ c格式化之前解析字符串$ c>。
I found this piece of information and got it to work correctly. The data given to me was in string format so I needed to parse the string using kendo.parseDate
before formatting it with kendo.toString
.
columns: [
{
field: "FirstName",
title: "FIRST NAME"
},
{
field: "LastName",
title: "LAST NAME"
},
{
field: "DateOfBirth",
title: "DATE OF BIRTH",
template: "#= kendo.toString(kendo.parseDate(DateOfBirth, 'yyyy-MM-dd'), 'MM/dd/yyyy') #"
},
...
参考文献:
References:
- format-date-in-grid
- < a href =http://jsfiddle.net/stevescotthome/kKhm3/5/ =nofollow noreferrer> jsfiddle
- kendo ui日期格式化
- format-date-in-grid
- jsfiddle
- kendo ui date formatting
这篇关于Kendo网格日期列不格式化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文