0

I am using Knockout with jQueryUI's autocomplete (and Pixel Admin bootstrap template).

I have created the input and bound that to my data:

<input data-bind="autoComplete: userSearch, value: userSearch, optionsText: 'fullName', optionsValue: 'userID', autoCompleteOptions: { autoFocus: false, appendTo: '#user-panel' }"" >

userSearch is a ko.computed that returns the data-set (array of objects).

This works fine.

My question is, how do I use the value that is returned by the autocomplete to filter the original data-set by the userID of the data returned?

I'm not really sure why the value property needs to be set to the dataset, but if I don't do this, when I select an option it only returns the userID (because that is the options value set).

Jeroen
  • 60,696
  • 40
  • 206
  • 339
Clay
  • 478
  • 4
  • 10
  • Your question does not have enough code. And, even without testing it, I'm pretty sure you can't have both `autoComplete: userSearch` and `value: userSearch`. – Tomalak Jun 23 '15 at 14:57
  • Is `autoComplete` a custom binding that you wrote? If it is, please share the code. If it's not, then you're probably *not doing it right*. – CrimsonChris Jun 23 '15 at 15:24
  • possible duplicate of [How to create an auto-complete combobox?](http://stackoverflow.com/questions/7537002/how-to-create-an-auto-complete-combobox) – CrimsonChris Jun 23 '15 at 15:28
  • the knockout king has wrote an awesome binding with usages here: https://github.com/rniemeyer/knockout-jqAutocomplete – segFault Jun 23 '15 at 17:20

0 Answers0