我有一个Kendo Grid,我需要添加一个DropDownList到我的网格代码是:
$("#grid").kendoGrid({
dataSource: dataSource,
pageable: true,
height: 550,
toolbar: ["create"],
columns: [
{ field:"ProductName", title: "Product Name" },
{ command: ["edit"], title: " ", width: "250px" }],
editable: "popup"
});
});
答案 0 :(得分:0)
尝试这样的事情:
columns: [
{
field: "ENCODE",
title: "Encoding",
width: "100px",
editor: encodingEditor
}
]
function encodingEditor(container, options) {
$('<input data-bind="value:' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
valuePrimitive: true,
autoBind: false,
dataTextField: "NAME",
dataValueField: "NAME",
dataSource: encodingDataSource
});
};
var encodingDataSource = new kendo.data.DataSource({
data: {
"items": [
{
"NAME": "DOS",
},
{
"NAME": "UKG",
},
{
"NAME": "WIN"
}
]
},
schema: {
data: "items",
model: {
fields: {
NAME: { type: "string" }
}
}
}
});