我正在使用带有datapicker字段的kendo Grid。当我保存记录时,它将少一天发送给控制器。
可能是什么问题? http://jsfiddle.net/valchev/BCBzS/17/
我使用相同的例子
<!-- grid element -->
<div id="grid" style="width: 700px; margin: 0 auto;"></div>
var data = createRandomData(50);
var autoCompleteDS = new kendo.data.DataSource({
data: [
{firstName: "Alex"},
{firstName: "Alice"},
{firstName: "Antony"},
{firstName: "Anne"},
{firstName: "Anna"}
]
});
$(document).ready(function() {
$("#grid").kendoGrid({
dataSource: {
data: data,
schema: {
model: {
fields: {
FirstName: { type: "string" },
LastName: { type: "string" },
City: { type: "string" },
Title: { type: "string" },
BirthDate: { type: "date" },
Age: { type: "number" }
}
}
},
pageSize: 10
},
height: 450,
scrollable: true,
sortable: true,
pageable: true,
editable: {
mode: "popup",
template: $("#popup_editor").html()
},
edit: function(e) {
$(e.container)
.find("input[name='FirstName']")
.data("kendoAutoComplete")
.bind("change", function(e) {
console.log("auto complete changed");
});
},
toolbar: ["create"],
columns: [
{
field: "FirstName",
title: "First Name",
width: 100
},
{
field: "BirthDate",
title: "Birth Date",
template: '#= kendo.toString(BirthDate,"MM/dd/yyyy") #'
},
{
field: "Age",
width: 100
},
{
command: ["edit", "destroy"],
title: " ",
width: "200px"
}
]
});
});
其实我选择的日期是10/07/2014但是当它发送数据时就像2014-07-09T18:30:00.000Z
这是因为JSON.stringify();