据我所知,以格式化,你必须处理它在parameterMap的日期值,
$('#listDiv').kendoGrid({
dataSource: {
type: 'json',
serverPaging: true,
pageSize: 10,
transport: {
read: {
url: '@Url.Action("_ListMy", "Placement")',
data: refreshGridParams,
type: 'POST'
},
parameterMap: function (options, operation) {
if (operation != "read") {
var d = new Date(options.StartDate);
options.StartDate = kendo.toString(new Date(d), "dd/MM/yyyy");
return options;
}
else { return options; }
}
},
schema: {
model: {
id: 'Id',
fields: {
Id: { type: 'number' },
StartDate: { type: 'date', format: 'dd/MM/yyyy' },
Area: { type: 'string' },
Length: { type: 'string' },
Display: { type: 'string' },
Status: { type: 'string' },
Edit: { type: 'string' }
}
},
data: "Data",
total: "Count"
}
},
scrollable: false,
columns:
[
{
field: 'StartDate',
title: 'Start Date',
format: '{0:dd/MM/yyyy}',
width: 100
},
如果你按照上面的例子,只是重命名,如“起始日期”对象,那么它应该工作(忽略'数据:refreshGridParams')
有关更多详细信息,请查看下面的链接或只是搜索kendo grid parameterMap,看看别人做了什么。
http://docs.kendoui.com/api/framework/datasource#configuration-transport.parameterMap
对不起Myzifer,仍然有问题。即使我尝试过模板:“#= kendo.toString(Date,'MM/dd/yyyy')#”也是。并试过这也http://onabai.wordpress.com/2012/09/28/kendoui-tips-and-tricks-on-dates-in-a-grid/但没有运气:( – jestges
就我而言意识到关键组件是参数映射设置,没有,你将有更大的困难尝试设置它,你需要更多的细节parameterMap? – Myzifer
是的,你可以提供更多的细节parameterMap – jestges