I'm using bootstrap typeahead with a jQuery ajax which we will call FILTER#1. In my case, an ajax search like "great tank" or "greattank" both produce a "Great Tank" ajax result but typeahead is 2nd guessing my results and double filtering out (we will call FILTER#2) the second result because of the space. It is also possible that my ajax result back may be totally different than what was typed. I need typeahead to trust that the results provided were valid and display them regardless of an exact lowercase text match.
I'd like to have the following behavior:
(1) works OOTB, but (2) is the missing feature I'm looking for. If I can't have (1) and (2) I'd be ok with dropping (1).
Here is a fiddle example: http://jsfiddle.net/PE9mN/
$("#title2").typeahead({
source: function( request, response ) {
var mockResults2 = ["Great Tank War",
"Great Train Robbery",
"other random result my server produced"];
response(mockResults2);
// I expect this to display both items regardless of $("#title2").val()
// In my case, the server was smart enough to realize that
// "greattank" may match "great tank"
// and it even added a 3rd value that I want to display.
}
});
Thanks.
If you add the following option to typeahead:
matcher: function(item) {
return true;
}
Then no "second" filtering will apply.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With