You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i'd appreciate a method i could call, so typeahead would init, pull in the defined json, do the search and present the results.
Currently i do this with a hack: $("input.typeahead").trigger("input");
Some background on why i'd find this useful:
im am trying to use typeahead.js not only for suggestions but for a complete search engine.
My goal is to offer the user suggestions while he types into the input field and then, once hits the return key, i'll load a searchresults page and display a complete list of all matches. The search results page pre populates the input field with from a parameter in the query string, wires the field up with .typeahead and would then need to call a method so typeahead will do its magic and display the results (which i reformat with jquery so they'll not be attached to the input field any longer).
The text was updated successfully, but these errors were encountered:
I've been kicking around the idea of adding a plugin method to retrieve suggestions from the datasets programmatically. Would something like the following support your use case:
// initialize the typeahead$('.typeahead').typeahead({/* options */});// after something happens and you want to retrieve the suggestions// for a arbitrary query programmatically $('.typeahead').typeahead('getSuggestions',query,function(suggestions){// do what you want with the suggestions here});
That'd be awesome and much cleaner for the use case i described. Thanks!
Still, being able to tell the input to update and show results would probably come in handy from time to time, so i hope $("input.typeahead").trigger("input"); won't go away anytime soon.
Hi,
i'd appreciate a method i could call, so typeahead would init, pull in the defined json, do the search and present the results.
Currently i do this with a hack: $("input.typeahead").trigger("input");
Some background on why i'd find this useful:
im am trying to use typeahead.js not only for suggestions but for a complete search engine.
My goal is to offer the user suggestions while he types into the input field and then, once hits the return key, i'll load a searchresults page and display a complete list of all matches. The search results page pre populates the input field with from a parameter in the query string, wires the field up with .typeahead and would then need to call a method so typeahead will do its magic and display the results (which i reformat with jquery so they'll not be attached to the input field any longer).
The text was updated successfully, but these errors were encountered: