Open codepic opened 11 years ago
Here's a JsFiddle to describe the issue: http://jsfiddle.net/codepic/v4bC4/
You can see when I'm selecting something from the typeahead list, it's not really binding back to model.
However if I change the updater in the typeahead binding like so, it starts working:
updater
typeahead
// Bind twitter typeahead ko.bindingHandlers.typeahead = { init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { var $element = $(element); var allBindings = allBindingsAccessor(); var typeaheadArr = ko.utils.unwrapObservable(valueAccessor()); $element.attr("autocomplete", "off") .typeahead({ 'source': typeaheadArr, 'minLength': allBindings.minLength, 'items': allBindings.items, // 'updater': allBindings.updater 'updater': function(item) { allBindings.value(item); return item; } }); } };
I'm not sure if this is an issue or just me using the binding wrong. I tried to go through the docs but it didn't help much.
Yea this looks like a bug I will incorporate your changes.
Here's a JsFiddle to describe the issue: http://jsfiddle.net/codepic/v4bC4/
You can see when I'm selecting something from the typeahead list, it's not really binding back to model.
However if I change the
updater
in thetypeahead
binding like so, it starts working:I'm not sure if this is an issue or just me using the binding wrong. I tried to go through the docs but it didn't help much.