Skip to content

Instantly share code, notes, and snippets.

@jharding
Last active March 12, 2020 20:29
Show Gist options
  • Save jharding/9458797 to your computer and use it in GitHub Desktop.
Save jharding/9458797 to your computer and use it in GitHub Desktop.
#multiple-datasets .league-name {
margin: 0 20px 5px 20px;
padding: 3px 0;
border-bottom: 1px solid #ccc;
}
<div id="multiple-datasets">
<input class="typeahead" type="text" placeholder="NBA and NHL teams">
</div>
var nbaTeams = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('team'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: '../data/nba.json'
});
var nhlTeams = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('team'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: '../data/nhl.json'
});
$('#multiple-datasets .typeahead').typeahead({
highlight: true
},
{
name: 'nba-teams',
display: 'team',
source: nbaTeams,
templates: {
header: '<h3 class="league-name">NBA Teams</h3>'
}
},
{
name: 'nhl-teams',
display: 'team',
source: nhlTeams,
templates: {
header: '<h3 class="league-name">NHL Teams</h3>'
}
});
@LISHITING
Copy link

Hi, I wonder where can i find the dataset : ../data/nba.json and ../data/nhl.json. ? Thanks

@Aoedia
Copy link

Aoedia commented Sep 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment