Last active
May 31, 2020 09:19
-
-
Save jharding/9458772 to your computer and use it in GitHub Desktop.
Example for http://twitter.github.io/typeahead.js/examples/.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="remote"> | |
<input class="typeahead" type="text" placeholder="Oscar winners for Best Picture"> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bestPictures = new Bloodhound({ | |
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), | |
queryTokenizer: Bloodhound.tokenizers.whitespace, | |
prefetch: '../data/films/post_1960.json', | |
remote: { | |
url: '../data/films/queries/%QUERY.json', | |
wildcard: '%QUERY' | |
} | |
}); | |
$('#remote .typeahead').typeahead(null, { | |
name: 'best-pictures', | |
display: 'value', | |
source: bestPictures | |
}); |
what if I want to filter remotely by a value of another field? How can I achieve this?
Is this outdated? It seems as though .typeahead() now only has 1 parameter: https://github.com/twitter/typeahead.js/blob/master/src/typeahead/typeahead.js#L16
I'm getting this error
ReferenceError: Bloodhound is not defined
var bestPictures = new Bloodhound({
BaqerNaqvi... what is data model your are returning in query.json? Does anybody have working example for asp.net mvc application?
Is there a way to send the query made by the user to the remote host for it to produce suggestions accordingly?
thanks works perfect on laravel 5.4
For a local json, what should be the url for remote?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
works perfectly in my case ! 👍