0

I'm having a difficulty using the jQuery combobox widget as mentioned here:

I'm using jQuery to load the options for the select using ajax, which means that upon creation of the combobox, there are no options in it. When I get the values from the ajax call, I set the first option to be be selected. This works fine for the underlying select, but not for the input-field which jQuery combobox has added.

I've seen the solution here but this will not work if the options are added after _create is called(also, it is kinda outdated since the widget by default handles this).

As far as I can tell, there are no relationsship between the underlying combobox and the input-field that makes the one update the other. Or am i wrong here?

Regards, Runar

Community
  • 1
  • 1
Runar Halse
  • 3,528
  • 10
  • 39
  • 59

1 Answers1

1

ok..solved this myself adding the following code snippet in _create :

        select.change(function() {
        var selected = select.children( ":selected" );
        input.val(selected.val() ? selected.text() : "");
        });

Then invoked change on the combo after values had been populated.

Runar Halse
  • 3,528
  • 10
  • 39
  • 59