![](/img/trans.png)
[英]Kendo Grid with Kendo Dropdownlist Selected value not updated
[英]Kendo grid dropdownlist issue
我在Kendo网格中的一列上使用自定义模板。 一切都很好,当检索数据时,下拉列表显示正确的值。 但是,当我单击编辑命令时,该行变为编辑模式,并且下拉列表未显示其值。 仅当我单击下拉列表时,该项目才会显示为选中状态。 我要的是在编辑模式下显示文本。
我的代码:
function customDdlEditor(container, options) {
$('<input required data-text-field="text" data-value-field="value" data-bind="value:' + options.field + '"/>')//data-text-field="text" data-value-field="value" data-bind="value:fieldType"
.appendTo(container)
.kendoDropDownList({
autobinds: false,
dataTextField: "text",
dataValueField: "value",
dataSource: ddl
});
}
var ddl = [{ text: "Text", value: "Text" },
{ text: "Date", value: "Date" },
{ text: "Number", value: "Number"}];
var Grid = $("#grid").kendoGrid({
dataSource: fieldDataSource,
columns: [
...
{ field: "type", title: "Type", editor: customDdlEditor, template: "#= type #" },
...
,
noRecords: true,
}).data("kendoGrid");
var fieldDataSource = new kendo.data.DataSource({
data: gridData,
pageSize: 50,
schema: {
model: {
id: "name",
fields: {
...,
type: { field: "type"},
...
}
}
}
});
有人知道如何解决吗?
如果您使下拉菜单中的autoBind:true起作用。
function customDdlEditor(container, options) {
$('<input required data-text-field="text" data-value-field="value" data-bind="value:' + options.field + '"/>')//data-text-field="text" data-value-field="value" data-bind="value:fieldType"
.appendTo(container)
.kendoDropDownList({
autobinds: true, // <-- auto bind true instead
dataTextField: "text",
dataValueField: "value",
dataSource: ddl
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.