bassjobsen / Bootstrap-3-Typeahead

The Typeahead plugin from Twitter's Bootstrap 2 ready to use with Bootstrap 3 and Bootstrap 4
1.68k stars 1.34k forks source link

Multiple Datasets with Bloodhound #112

Open mrchief opened 9 years ago

mrchief commented 9 years ago

Was wondering if it supports Bloodhound's Multiple Dataset. I tried passing multiple source objects but it doesn't seem to work.

$('#multiple-datasets .typeahead').typeahead({
  name: 'nba-teams',
  displayKey: 'team',
  source: nbaTeams.ttAdapter(),
  templates: {
    header: '<h3 class="league-name">NBA Teams</h3>'
  }
},
{
  name: 'nhl-teams',
  displayKey: 'team',
  source: nhlTeams.ttAdapter(),
  templates: {
    header: '<h3 class="league-name">NHL Teams</h3>'
  }
});
bassjobsen commented 9 years ago

Nope multiple dataset is not supported yet. Unless there are many votes for it, i don't expect support for it soon. Possible merging dataset is not a task for typeahead at all. You could write a layer which merge your sets and connects with typeahead

mrchief commented 9 years ago

Hmmm. Suspected so.

Anyway, here's a workaround: Since I need multiple datasets, I went with the original typeahead.js. To make the css work with Bootstrap 3, I used this: https://github.com/hyspace/typeahead.js-bootstrap3.less