I have just converted over to using Bloodhound.js and Typeahead.js with Knockout. I am having a few issues -
- The Typeahead is not displaying the
Name
property in the suggestions list - I can't figure out how to update the set to query against
I am 'statically' adding new data right now but it should still show up in the result set, and is not
self.addNew = function () {
self.someOptions.push(new Option(self.someOptions().length + 1, 'Johnnn'));
}
I am up for any suggestions that work, so I am not stuck using Bloodhound.js if it isn't required, but due to the nature of my app I cannot remove the properties as observables, but calling ko.toJS at some point is definitely an option.
The first issue is with the displayKey. You need to supply an explicit function in your binding
HTML
Javascript
The second problem is with the use of local. It looks like the system doesn't recalculate the source after initialization. Looking at the docs you probably need to make use of the remote option and pretend to be an ajax request/response. You also need to implement your own result filter, as well as hacking around either requestCache when options are updated.
I've update your jsFiddle with the following...