我对剑道网格自定义编辑器有疑问。当我单击剑道网格上的编辑按钮时,我想使用 dateTimePicker 作为我的编辑器。但是当我尝试使用 dateTimePicker 自定义我的网格时,总是会出现错误:
Uncaught TypeError: e.indexOf is not a function ---------- kendo.custom.min.js:1
这是简单的源代码:
var data = [
{"id":1, "dateTime": 1420947900000},
{"id":2, "dateTime": 1421034300000},
{"id":3, "dateTime": 1421036100000},
];
$("#grid").kendoGrid({
selectable: true,
editable: "inline",
columns: [
{
field: "dateTime",
title: "<center>Date Time</center>",
width: "200px",
format: "{0:MM/dd/yyyy hh:mm}",
template: "#= kendo.toString(new Date(parseInt(dateTime)), 'MM/dd/yyyy hh:mm') #",
editor: dateTimeEditor2
},
{ command: ["edit", "destroy"], title: " ", width: "170px" }
],
dataSource: {
transport: {
read: function(e) {
e.success(data);
},
update: function(e) {
//my update Function
alert(e.dateTime);
},
autosync: true
},
schema: {
model: {
id: "id",
fields: {
dateTime: { type: "datetime" },
}
}
}
}
});
function dateTimeEditor2(container, options) {
$('<input data-text-field="' + options.field + '" data-value-field="' + options.field
+ '" data-bind="value:' + options.field + '" />')
.appendTo(container)
.kendoDateTimePicker({
format:"MM/dd/yyyy hh:mm",
value: new Date(options.model.dateTime)
});
}
或者您可以在此链接上查看
我也已经在许多不同的来源上检查过它,例如: