我正在和Jquery一起使用Kendo Grdi。该网格具有DateTime列。该列中的数据显示为“/ Date(1377196200000)/”。帮我把它安排到正确的格式。
这是我网格的脚本;
函数LoadGridView(){
var dataSource = GetDataSource();
$("#batchgrid").kendoGrid({
dataSource: dataSource,
editable: "inline",
selectable: "row",
toolbar: ["create"],
autobind: true,
reorderable: true,
pageable: {
refresh: true,
pageSizes: [5, 10, 20, 50, 100]
},
sortable: {
mode: "multiple"
},
sort: { field: "PrjNm", dir: "asc" },
groupable: {
messages: {
empty: "Drop columns here"
}
},
columnMenu: {
sortable: true,
filterable: true,
messages: {
columns: "Hide/Show Columns",
filter: "Apply filter",
sortAscending: "Sort (asc)",
sortDescending: "Sort (desc)"
}
},
resizable: true,
dataBinding: function () {
record = (this.dataSource.page() - 1) * this.dataSource.pageSize();
},
filterable: {
messages: {
and: "And",
or: "Or",
filter: "Apply filter",
clear: "Clear filter",
info: "Filter by"
},
extra: false, //do not show extra filters
operators: { // redefine the string operators
string: {
contains: "Contains",
doesnotcontain: "Doesn't contain",
startswith: "Starts With",
endswith: "Ends"
},
number: {
eq: "Is Equal To",
neq: "Not equal to",
gte: "Greater than or equal to",
lte: "Less than or equal to",
gt: "Greater than",
lt: "Less than"
}
}
},
navigatable: true,
columns: [
{ title: "No", template: "#= ++record #", width: 45 },
{ field: "ItemCode", title: "Item Code", width: "150px" },
{ field: "ItemName", title: "Item Name", format: "{0:c}", width: "300px" },
{ field: "PreviousDate", title: "Previous Date", type: "date", format: "{0:dd/MM/yyyy}" },
{ field: "PreviousValue", title: "Previous %", width: "110px", format: "{0:2}" },
{ field: "Value", t`enter code here`itle: "%", width: "150px", format: "{0:2}" },
{ command: ["edit"], title: " ", width: "175px" }
]
});
}
答案 0 :(得分:2)
确保 DataSource 在模型中正确定义日期字段类型(作为日期),如下所示:
model: {
fields: {
PreviousDate: { type: "date" },
}
}