knockout-jqueryui icon indicating copy to clipboard operation
knockout-jqueryui copied to clipboard

autocomplete and two way binding

Open pathsny opened this issue 10 years ago • 1 comments

Is there a way to setup two way binding with autocomplete. As it is autocomplete uses objects with label and value properties. What would be ideal is if the autocomplete widget could get proper two way binding with an observable, and the value of the widget was always set to the label.

pathsny avatar Mar 23 '15 02:03 pathsny

Doable for simple lists of values without related ids.

http://stackoverflow.com/a/17060235/2438830

This may suit my use-case as I'm using denormalised data and another copy of the name is no big deal.

Related keys aren't dumped in the HTML attributes so can't lookup the related menu item and trigger menuselect as you need the related dropdown element.

The source function itself is interesting, takes a term and triggers a callback with the matching object, however we need the reverse of that. The filter function only checks value and label.

Not seeing anything on the jQuery end which could be used to hook in, it's all tied to the dropdown elements themselves. Could be extended to do so, but not sure how their release schedule works...

mryellow avatar Jul 16 '15 01:07 mryellow