LeaVerou / awesomplete

Ultra lightweight, usable, beautiful autocomplete with zero dependencies.

Home Page:http://leaverou.github.io/awesomplete/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Properly loaded and ajax populated list: select a value at the press of a button

ItItaca opened this issue · comments

Hi all,
I'm successfully populating an awesomplete element using ajax with value - label objects.
Suggestions work as expected, and selection events trigger as planned. Using the selectcomplete event, the value is written in a hidden input, and the label is written in the dropdown input.
However I need to be able to -manually select- an item in the list, at the press of a button on the page, but this doesn't seem to work.
I can't understand if it's because of the value - label objects, or something else.

I've tried setting the .val() manually, by using the .select() but both methods simply don't select the value, despite not raising errors or warnings.
This happens both with and without .evaluate() after the data-load (the ._list property is properly filled).

Could it be that the combo needs to be .open() or something else, before .select() or .val() become viable? this doesn't seem to be easily tested since breakpoints in the code break the focus flow and the events, while using the inspector of the browsers.

Any suggestion welcome.

Thanks in advance.