-
-
Save josx/9134760 to your computer and use it in GitHub Desktop.
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 nba = new Bloodhound({ | |
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.team); }, | |
queryTokenizer: Bloodhound.tokenizers.whitespace, | |
prefetch: '../data/nba.json' | |
}); | |
var nhl = new Bloodhound({ | |
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.team); }, | |
queryTokenizer: Bloodhound.tokenizers.whitespace, | |
prefetch: '../data/nhl.json' | |
}); | |
nba.initialize(); | |
nhl.initialize(); | |
$('.example-sports .typeahead').typeahead({ | |
highlight: true | |
}, | |
{ | |
name: 'nba', | |
displayKey: 'team', | |
source: nba.ttAdapter(), | |
templates: { | |
header: '<h3 class="league-name">NBA Teams</h3>' | |
} | |
}, | |
{ | |
name: 'nhl', | |
displayKey: 'team', | |
source: nhl.ttAdapter(), | |
templates: { | |
header: '<h3 class="league-name">NHL Teams</h3>' | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for linking this to the Twitter Example. Very Helpful.