corejavascript / corejavascript/typeahead.js

Highest hit on top, even with multiple sources?

Open
#177 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
968
Forks
231
PR merge metrics
No merged PRs in 30d

Description

I'm getting the following result when using multiple sources (and bloodhound).
Is there anyway I can get it to the top? So that the results are not sorted by group but by biggest hit?

![screen shot 2018-01-04 at 15 18 45](https://user-images.githubusercontent.com/4146384/34567466-bb5ee2de-f162-11e7-9ad6-e4da8752bfdc.png)

This is my current code.

$(".global-search input").typeahead({
hint: true,
highlight: true,
minLength: 2,
maxItem: 30,
dynamic: true,
}, {
source: suppliersEngine.ttAdapter(),
name: 'suppliers',
templates: {
suggestion: function (data) {
return ''+ data.name + ' Suppliers';
}
}
}, {
source: recipesEngine.ttAdapter(),
name: 'recipes',
templates: {
suggestion: function (data) {
return ''+ data.name + ' Recipes';
}
}
}, {
source: preparationsEngine.ttAdapter(),
name: 'preparations',
templates: {
suggestion: function (data) {
return ''+ data.name + ' Preparations';
}
}
});

Any help would be greatly appreciated!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.