Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes the 'val' method set the query silently. #187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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