Kendo ui 获取javascript错误";对象没有';t支持属性或方法';获取'&引用;在网格编辑器的分组剑道下拉列表中选择选项时
我试图创建一个剑道下拉列表,将自定义编辑器分组到剑道网格中的一个字段。使用编辑器时,下拉列表成功填充了分组,但是选择任何选项都会抛出javascript错误“Object不支持属性或方法'get'” 相关代码如下: 编辑器功能:Kendo ui 获取javascript错误";对象没有';t支持属性或方法';获取'&引用;在网格编辑器的分组剑道下拉列表中选择选项时,kendo-ui,kendo-grid,kendo-dropdown,Kendo Ui,Kendo Grid,Kendo Dropdown,我试图创建一个剑道下拉列表,将自定义编辑器分组到剑道网格中的一个字段。使用编辑器时,下拉列表成功填充了分组,但是选择任何选项都会抛出javascript错误“Object不支持属性或方法'get'” 相关代码如下: 编辑器功能: function productDropDownEditor(container, options) { $('<input required name="' + options.field + '"/>') .app
function productDropDownEditor(container, options) {
$('<input required name="' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
autoBind: false,
dataTextField: "Name",
dataValueField: "Product_ID",
dataSource: {
transport: {
type: "json",
read: {
url: "http://localhost/Application/GetProducts",
dataType: "json",
type: "POST"
}
},
group: { field: "Category" }
}
});
}
以下是调用更新编辑器模板的网格,仅供参考:
var testSuiteGrid = $("#productsGrid").kendoGrid({
dataSource: {
transport: {
read: {
url: http://localhost/Application/GetStoreProducts,
dataType: "json",
type: "POST"
},
update: {
url: http://localhost/Application/UpdateStoreProducts,
datatype: "json",
type: "POST",
complete: function (e) {
productGrid.data("kendoGrid").dataSource.read();
}
},
create: {
url: http://localhost/Application/AddStoreProducts,
dataType: "json",
data: {
},
type: "POST",
complete: function (e) {
productGrid.data("kendoGrid").dataSource.read();
}
},
destroy: {
url: http://localhost/Application/RemoveStoreProducts,
dataType: "json",
data: {
},
type: "POST",
complete: function (e) {
productGrid.data("kendoGrid").dataSource.read();
}
}
}
},
toolbar: ["create"],
editable: {
createAt: "bottom",
mode: "inline"
},
columns: [
{ field: "Product_ID" },
{ field: "Product_Description" },
{ field: "Product_ID", title: "Product", editor: productDropDownEditor, template: "#=ProductName#" },
{ command: ["edit", "destroy"] }
],
resizable: true,
scrollable: false
});
我根据您提供的代码创建了一个dojo(带有一个硬编码数组作为数据源的数据,因为我无法访问您的URL),并对第二个“Product_ID”列定义进行了一些调整(假设它应该是“Name”):它似乎在工作……你能用dojo作为起点复制你的问题吗?感谢你的关注,我查看了你的dojo,我意识到我在创建上面的示例时可能过度简化了我的问题,因为我的问题不仅仅是一个带一个字段的模板字段,但几个因素的综合可能会使事情复杂化。我将修改我的示例以更好地说明它。我根据您提供的代码创建了一个dojo(使用硬编码数组作为数据源的数据,因为我无法访问您的URL),并对第二个“Product_ID”列定义进行了一些调整(假设它应该是“Name”):它似乎在工作……你能用dojo作为起点复制你的问题吗?感谢你的关注,我查看了你的dojo,我意识到我在创建上面的示例时可能过度简化了我的问题,因为我的问题不仅仅是一个带一个字段的模板字段,但几个因素的综合可能会使事情复杂化。我将修改我的例子以更好地说明它。
var testSuiteGrid = $("#productsGrid").kendoGrid({
dataSource: {
transport: {
read: {
url: http://localhost/Application/GetStoreProducts,
dataType: "json",
type: "POST"
},
update: {
url: http://localhost/Application/UpdateStoreProducts,
datatype: "json",
type: "POST",
complete: function (e) {
productGrid.data("kendoGrid").dataSource.read();
}
},
create: {
url: http://localhost/Application/AddStoreProducts,
dataType: "json",
data: {
},
type: "POST",
complete: function (e) {
productGrid.data("kendoGrid").dataSource.read();
}
},
destroy: {
url: http://localhost/Application/RemoveStoreProducts,
dataType: "json",
data: {
},
type: "POST",
complete: function (e) {
productGrid.data("kendoGrid").dataSource.read();
}
}
}
},
toolbar: ["create"],
editable: {
createAt: "bottom",
mode: "inline"
},
columns: [
{ field: "Product_ID" },
{ field: "Product_Description" },
{ field: "Product_ID", title: "Product", editor: productDropDownEditor, template: "#=ProductName#" },
{ command: ["edit", "destroy"] }
],
resizable: true,
scrollable: false
});