Skip to content

Conversation

nzifnab
Copy link

@nzifnab nzifnab commented Jun 25, 2018

Currently, the only time silent is used when setting the query is in
the default select method (here: https://github.com/corejavascript/typeahead.js/blob/master/src/typeahead/typeahead.js#L367); an item is selected, and the value is set
silently such that another query to the autocompleter won't be made. I
believe this should always happen when triggering $element.typeahead('val', aValue);

When I manually call val on a typeahead object, it is never because I
want to autocomplete a result. It is because I am populating that value
either from a selected dataset (custom render/select method) or from
another source. This redundant querying can cause problems when the
source is a remote that charges per request, for example (mapquest
autocomplete addresses, in my case).

If you truly want to fill in an input value and trigger an
autocomplete request, use the new query method instead.

Currently, the only time 'silent' is used when setting the query is in
the default 'select' method; an item is selected, and the value is set
silently such that another query to the autocompleter won't be made. I
believe this should always happen when triggering $element.typeahead('val',
aValue);

When I manually call 'val' on a typeahead object, it is never because I
want to autocomplete a result. It is because I am populating that value
either from a selected dataset (custom render/select method) or from
another source. This redundant querying can cause problems when the
source is a remote that charges per request, for example (mapquest
autocomplete addresses, for one).

If you *truly* want to fill in an input value and trigger an
autocomplete request, use the new 'query' method instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant