我有一个可编辑的Kendo网格,在其中一个列中有一个下拉列表。在将新行添加到网格后,前一条记录重置中的下拉值将被保留在模型中。
我有创建了一个DOJO来复制我的问题。任何帮助都将不胜感激。点击这里!
发布于 2017-03-07 11:35:47
查看由Kendo 带下拉示例的网格提供的示例。
我认为您的代码应该类似于这种方法,
下拉列需要使用编辑器和模板,如下所示。
columns: [{ field:"ProductName",title:"Product Name" },
{ field: "Category", title: "Category", width: "180px", editor: categoryDropDownEditor, template: "#=Category.CategoryName#" },
{ field: "UnitPrice", title:"Unit Price", format: "{0:c}", width: "130px" },
{ command: "destroy", title: " ", width: "150px" }],下拉创建必须遵循以下方法,以便为每个下拉列表创建新的上下文。下面的函数将被调用,如下代码所示
function categoryDropDownEditor(container, options) {
$('<input required name="' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
autoBind: false,
dataTextField: "CategoryName",
dataValueField: "CategoryID",
dataSource: {
type: "odata",
transport: {
read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Categories"
}
}
});
}希望这有帮助:)
https://stackoverflow.com/questions/42591862
复制相似问题