typeahead.js icon indicating copy to clipboard operation
typeahead.js copied to clipboard

Event typeahead:autocompleted not triggered

Open sequielo opened this issue 13 years ago • 5 comments

I created a fiddle [1] based on the playground file (https://github.com/twitter/typeahead.js/blob/master/test/playground.html)

There, the event typeahead:autocompleted is not triggered (other events are), so my assumptions where correct.

I think this event is very useful for showing a spinner image for remote population (but I couldn't rely on this because is not working).

[1] http://jsfiddle.net/Xx3r5/1

sequielo avatar Sep 27 '13 05:09 sequielo

I'm having the same issue. When is this event meant to be fired?

goesbysteve avatar Oct 24 '13 11:10 goesbysteve

I believe it should be triggered after an item is selected. But I don't know the original developer thought about this.

In the testing code [https://github.com/twitter/typeahead.js/blob/master/test/typeahead_view_spec.js] it has some possible scenarios.

sequielo avatar Oct 24 '13 19:10 sequielo

I looked at the source, it's my misunderstanding of the trigger. It is only triggered when a user presses tab or right/left arrow keys to autocomplete on the best match (1st in list?). I thought it was when the hint was set behind the input. I'm forking and adding that event with the hint datum so it can be used by default if a user hits enter thinking the hint has already been selected.

goesbysteve avatar Oct 25 '13 08:10 goesbysteve

That will be really nice!

Sorry I didn't mentioned more details. The particular workflow I had tried was to use remote loading while showing a spinner animation. The autocompleted event in this case could be triggered after typeahead fills the list.

The event you have described I believe is "selected" (I've tested with the fiddle I've created).

Thank you for your time!

sequielo avatar Oct 25 '13 20:10 sequielo

The explanation of typeahead:autoselected given by @stevegibbings is correct.

jharding avatar Dec 27 '13 07:12 jharding