我將組合框綁定到一個複雜的對象上,綁定是這樣的,即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'財產後父母和冒號後沒有任何東西。請修正您的代碼。 –