【发布时间】:2014-03-14 04:17:16
【问题描述】:
我想在我的网格使用下拉列表。这是我的格网定义:
$("#grid").kendoGrid({
editable: true,
dataSource: {
data: data,
schema: {
model: {
fields: {
Name: {
type: "string",
editable: false
},
FruitName: {
type: "string"
},
FruitID: {
type: "number"
}
}
}
}
},
columns: [{
field: "Name",
title: "Name",
width: 150
}, {
field: "Fruit",
title: "Fruit",
width: 115,
editor: renderDropDown,
template: "#=FruitName#"
}]
});
这是我的编辑功能: P>
function renderDropDown(container, options) {
var dataSource = [
//{ name: "", id: null },
{
FruitName: "Apple",
FruitID: 1
}, {
FruitName: "Orange",
FruitID: 2
}, {
FruitName: "Peaches",
FruitID: 3
}, {
FruitName: "Pears",
FruitID: 4
}];
$('<input required name="' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
dataTextField: "FruitName",
dataValueField: "FruitID",
dataSource: dataSource
});
}
下面是为了说明上JSBin演示:http://jsbin.com/malev/3/edit P>
矿是一个2部分的问题。 P>
-
为什么没有在此示例中默认为在列中的值的下拉之前它的编辑?
LI> -
为什么文本转换为值作出选择之后
LI>
【问题讨论】:
标签: javascript kendo-ui kendo-grid kendo-dropdown