By default twitter typeahead.js returns only elements matched in the begining of a string, for example:
source: ['type','typeahead','ahead']
query: 'type'
returns: 'type' and 'typeahead'
--
query: 'ahead'
returns: 'ahead'
I want it to return 'ahead' and 'typeahead'
my code:
var clients = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.value); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 10,
prefetch: {
url: '/clients.json',
filter: function(list) {
return $.map(list, function(value) { return { name: value }; });
}
}
});
clients.initialize();
$('.client').typeahead(null, {
displayKey: 'value',
source: clients.ttAdapter(),
minLength: 1,
});
There is already a question about it but i didnt understand the answer.