当我在 selectedItems 属性中设置索引以在 igCombo 中显示预设值时,只要 itemTemplate 不用于生成文本值。
$(selector).igCombo({
dataSource: this.userComboDs,
width: '300px',
textKey: 'line1',
valueKey: 'id',
mode: 'dropdown',
enableClearButton: false,
closeDropDownOnSelect: true,
itemTemplate: "<span>${city}, ${line1}</span>",
selectedItems: [
{
index: 1 // random index value
}],
selectionChanged: function (evt, ui){
},
filteringType: "local",
filterCondition: "contains",
renderMatchItems: "contains"
});