gpt4 book ai didi

jquery - Kendo Ui Grid 日期时间转换问题

转载 作者:行者123 更新时间:2023-12-01 04:12:45 25 4
gpt4 key购买 nike

我将 Kendo Grdi 与 Jquery 结合使用。该网格有日期时间列。该列中的数据显示为“/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" }
]
});

}

最佳答案

确保您的数据源在模型中正确定义日期字段类型(作为日期),如下所示:

model: {
fields: {
PreviousDate: { type: "date" },
}
}

关于jquery - Kendo Ui Grid 日期时间转换问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18400472/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com