twitter / typeahead.js

typeahead.js is a fast and fully-featured autocomplete library
http://twitter.github.io/typeahead.js/
MIT License
16.52k stars 3.21k forks source link

A way to get the name of the data set while using multiple data sets #1808

Open anthonysbrown opened 1 year ago

anthonysbrown commented 1 year ago

Hello, is it possible to get the name of the data set when using multiple data sets? I want to do something different on select based on which data is being used. Below is my typeahead code, the data is being sent through json using bloodhound.

For instance if it's coming from the providers I want it to return the "name" providers

Thank you!

$('.n-search-all').typeahead({ highlight: true }, { name: 'providers', display: 'text', source: nSearchProviders, templates: { header: '<h3 class="n-search-cat-name">Providers</h3>' } }, { name: 'locations', display: 'text', source: nSearchLocations, templates: { header: '<h3 class="n-search-cat-name">Locations</h3>' } }, { name: 'services', display: 'text', source: nSearchServices, templates: { header: '<h3 class="n-search-cat-name">Services</h3>' } });