我在我的应用程序中使用剑道网格。 在那个网格中,我使用了kendo下拉列表。 我有一个数组,用于该dropdownlist的数据源。 阵列看起来像从下拉列表中选择选项后显示对象对象的Kendo UI网格中的下拉
var arr = [{text: "demo 1", value: 1}, {text: "demo 2", value: 2}]
我DROPDOWNLIST看起来像:
$("#grid").kendoGrid({
dataSource: dataSource,
navigatable: true,
pageable: true,
height: 550,
filterable: {
mode: "row"
},
sortable: {
mode: "single",
allowUnsort: false
},
toolbar: ["create"],
columns: [
{ field: "Item", title: "Item", width: "300px", editor: categoryDropDownEditor }
],
editable: true
});
function categoryDropDownEditor(container, options) {
$('<input data-text-field="text" data-value-field="value" data-bind="value:' + options.field + '" />')
.appendTo(container)
.kendoDropDownList({
dataSource: arr,
autoBind: true,
dataTextField: "text",
dataValueField: "value",
});
}
它表示下拉正确,但是从下拉选择选项之后的文本向下它显示对象对象作为所选择的文本。
附下拉选择的价值和期权后的截图选择 Image of option selecting 和 After option selected
我已经尝试了很多解决方案,但没有工作了。 如果有人提供解决方案,那将会很棒。
感谢
你提供的小提琴也有同样的问题。 尝试添加新记录,然后从下拉列表中选择选项。它显示“对象对象” – Gourav
我在'kendoDropDownList'上添加了一个'valuePrimitive'。 http://jsfiddle.net/0zauzskn/6/ –
感谢但增加valuePrimitive显示我的价值,如果我使用dataValueField:“值”而不是“文本”的选项。 我必须添加dataValueField作为值,因为我需要将其保存在数据库中。 – Gourav