If I type in characters, use arrow up down to select then press tab (to go to the next field in my form) the below code is giving me an error (at lines 62-75). options.value is the actual value set to the autocomplete in initialization.
//user made a change without selecting a value from the list
config.change = function (event, ui) {
if (!ui.item || !ui.item.actual) {
options.value(event.target && event.target.value);
if (ko.isWriteableObservable(options.dataValue)) {
options.dataValue(null);
}
}
if (existingChange) {
existingChange.apply(this, arguments);
}
};
my viewmodel looks like..
self.VendorList = function (searchTerm, callback) {
$.ajax({
url: urlAutoCompleteVendor,
type: "POST",
dataType: "json",
data: { term: searchTerm },
success: function (data) {
callback($.map(data, function (item) {
return { ShortName: item.ShortName, Id: item.Id };
}))
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert('error occurred while autocomplete')
}
})
}
If I type in characters, use arrow up down to select then press tab (to go to the next field in my form) the below code is giving me an error (at lines 62-75). options.value is the actual value set to the autocomplete in initialization.
my viewmodel looks like..
self.VendorList = function (searchTerm, callback) { $.ajax({ url: urlAutoCompleteVendor, type: "POST", dataType: "json", data: { term: searchTerm }, success: function (data) { callback($.map(data, function (item) { return { ShortName: item.ShortName, Id: item.Id }; })) }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert('error occurred while autocomplete') } }) }
and binding ...