我正在使用剑道网格,并且正在尝试使 Name 字段成为具有自己的数据源的组合框。我没有收到 javascript 错误,但是当我在网格中编辑名称字段时,它没有显示 ComboBox。它仍然显示一个输入字段。
$(function () {
console.log("ready");
var datasource = new kendo.data.DataSource({
transport: {
read: {
url: "", // Returns all items
dataType: "json"
}
},
pageSize: 10,
schema: {
model: {
id: "Id",
fields: {
Id: { type: "number", editable: false, nullable: false, visible: false },
Name: { type: "string", editable: true, nullable: false, validation: { required: true} },
Description: { type: "string", editable: true, validation: { required: true} }
}
}
}
});
var grid = $("#grid").kendoGrid({
dataSource: datasource,
editable: true,
height: 400,
columns: [
{ field: "Id", width: 200 },
{
field: "Name",
editor: function (container, options) { // This is where you can set other control types for the field.
$('< input name="' + options.field + '"/>').appendTo(container).kendoComboBox({
dataSouce: [{ Id: "1", Name: "MaryMaryMary" }, { Id: "2", Name: "John"}],
dataValueField: "Id",
dataTextField: "Name",
});
}
}
],
dataBound: function (e) {
console.log("DataBound");
}
});
});
我没有收到任何 javascript 错误。