knockout-jqueryui
knockout-jqueryui copied to clipboard
autocomplete and two way binding
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.
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...