Javascript Knockout-Kendo.js网格UI:datepicker过滤器
我正在使用集成库 我正在尝试让datepicker过滤器工作。但是,每当我向配置中添加filterable:{ui:“datetimepicker”}时,页面上不会显示任何内容,也不会出现脚本错误 我的kendoGrid配置看起来像(这里在SubmittedDate上具有filterable属性)Javascript Knockout-Kendo.js网格UI:datepicker过滤器,javascript,date,kendo-grid,knockout-kendo,kendo-ui-grid,Javascript,Date,Kendo Grid,Knockout Kendo,Kendo Ui Grid,我正在使用集成库 我正在尝试让datepicker过滤器工作。但是,每当我向配置中添加filterable:{ui:“datetimepicker”}时,页面上不会显示任何内容,也不会出现脚本错误 我的kendoGrid配置看起来像(这里在SubmittedDate上具有filterable属性) 我认为这可能是由于提交数据中的日期字符串格式错误造成的。 请尝试使用此选项: filterable: { cell: { template: f
我认为这可能是由于
提交数据中的日期字符串格式错误造成的。
请尝试使用此选项:
filterable: {
cell: {
template: function (args) {
args.element.kendoDatePicker({
format: "MM dd yyyy, h:mm:ss tt zzz",
parseFormats: ["MM dd yyyy, h:mm:ss tt zzz"]
});
}
}
}
如果日期字符串中有时区,请尝试将datasource
中的所有日期转换为kendo
()的正确格式:
filterable: {
cell: {
template: function (args) {
args.element.kendoDatePicker({
format: "MM dd yyyy, h:mm:ss tt zzz",
parseFormats: ["MM dd yyyy, h:mm:ss tt zzz"]
});
}
}
}
dateToLocalUTCString = function (date, isUtc) {
var pad = function (number) {
var r = String(number);
if (r.length === 1) {
r = '0' + r;
}
return r;
}
return date.getFullYear()
+ "-" + pad(date.getMonth() + 1)
+ "-" + pad(date.getDate())
+ "T" + pad(date.getHours())
+ ":" + pad(date.getMinutes())
+ ":" + pad(date.getSeconds())
+ "." + String((date.getMilliseconds() / 1000).toFixed(3)).slice(2, 5)
+ (isUtc ? "Z" : "");
};