0
我已創建一個igComboBox與它的數據源設置爲observableArray。當我向數組添加項目時,我希望組合框的數據源自動提取新值,而不必明確設置self.datasource:sourceListArray()。我怎樣才能做到這一點?IgniteUI組合框數據源更新與敲除
self.sourceListArray = ko.observableArray();
$("#dataSource").igCombo({
allowCustomValue: false,
showDropDownButton: true,
enableClearButton: false,
dataSource: self.sourceListArray(),
nullText: "Select Data Source",
selectionChanged: self.dataSourceChanged
});
function PopulateSourceList(sourceList) {
for (var i = 0; i < sourceList.length; i++) {
self.sourceListArray.push(sourceList[i].ServiceName);
}
$("#dataSource").igCombo({ dataSource: self.sourceListArray() }); //don't want this
}