billpull / knockout-bootstrap

A plugin that adds custom bindings for twitter bootstrap objects such as tooltips and popovers.
233 stars 69 forks source link

Typeahead doesn't update list when the bound observableArray changes #65

Open gerritdaniels opened 9 years ago

gerritdaniels commented 9 years ago

The typeahead binding only has an init method, so when the observable changes the new values don't get set to tht typeahead source. You can add the following update method to the typehead binding:

 update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
    var $element = $(element);
    $element.attr("autocomplete", "off").data('typeahead').source = ko.utils.unwrapObservable(valueAccessor());
}