Kendo Web UI Grid里时间格式转换

我和大家分享一下我的kendo的学习心得。如果不好的地方多多包含或者给我留言请看图

kendo里时间格式如图Oder Date列里的格式。但是我们想把时间转换成中国人习惯的格式。如Shipped Date列里的格式。

这个就要在设置列里加一个格式format: "{0:yyyy/MM/dd}"请记住开头的 格式都要加一个0:你要排在前面的日期字母。如月/日格式:format:"{0:MM/dd}",单独月:format:"{0:MM}"整个Grid显示效果代码:

<div id="grid"></div>

<script>
$(document).ready(function() {
$("#grid").kendoGrid({
dataSource: {
type: "odata",
transport: {
read: "http://demos.telerik.com/kendo-ui/service/Northwind.svc/Orders"
},
schema: {
model: {
fields: {
OrderID: { type: "number" },
ShipCountry: { type: "string" },
ShipCity: { type: "string" },
ShipName: { type: "string" },
OrderDate: { type: "date" },
ShippedDate: {type: "date" }
}
}
},
pageSize: 15
},
height: 430,
sortable: true,
reorderable: true,
resizable: true,
pageable: true,
columns: [
{
field: "OrderDate",
title: "Order Date",
width: 110,
format: "{0:MM/dd/yyyy}"
},
{
field: "ShipCountry",
title: "Ship Country",
width: 110
},
{
field: "ShipCity",
title: "Ship City",
width: 110
},
{
field: "ShipName",
title: "Ship Name",
width: 200
},
{
field: "ShippedDate",
title: "Shipped Date",
format: "{0:yyyy/MM/dd}"
},
{
field: "OrderID",
title: "ID",
width: 60
}
]
});
});
</script>
</div>

详细访问http://demos.telerik.com/kendo-ui/web/grid/column-reordering.html

 

转载于:https://www.cnblogs.com/qmli/p/3633717.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值