我将组合框绑定到一个复杂的对象上,绑定是这样的,即ID字段作为此对象的直接属性可用,但文本属性来自子对象属性。复杂对象的KendoUI组合框配置
我已经能够配置它正确显示的值,但运行到问题指定optionLabel说:“选择”不能够指定Parent.Childproperty获得运行时错误(遗漏的类型错误:无法读取属性“Childproperty”未定义)
如何在模型定义中指定复杂对象并在空白选择下方指定复合对象?
$('<input id="DegreeDDL" name="' + options.field + '"/>').appendTo(container).kendoDropDownList({
autoBind: true,
serverFiltering: true,
optionLabel: {
'Parent.Childproperty': "--- Select ---",
ABCD_PK: null
},
dataSource: {
transport: {
read: {
url: function (e) {
return "api/Org/XXXXXXXX?abcdPK=" + efgh;
},
dataType: "json" // <-- The default was "jsonp"
}
},
},
dataTextField: "Parent.ChildProperty",
dataValueField: "ABCD_PK"
});
网格
var model = {
id: "ABCD_PK",
fields: {
Parent.Child.ChilProperty:
}
}
我不想抱怨,但这是DropDownList不是ComboBOx正如你在标题中提到的,在你的代码中,你有'dataTextField:“Parent.ChildProperty”',然后'Parent.Child.ChilProperty:''Child'财产后父母和冒号后没有任何东西。请修正您的代码。 –