New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom search functionality #71

neolution-ch opened this Issue Sep 1, 2015 · 4 comments


None yet
3 participants

neolution-ch commented Sep 1, 2015

Let's say we have a typeahead for people. In the result we show each person with its name in the format "{FirstName} {LastName}". If I'd search for "Jane Miller" everything would work fine. But if I'd search for "Miller Jane" or "Miller, Jane" it won't.

Is it possible to customize the search functionality of the plugin in that way? And if yes, how?


This comment has been minimized.


running-coder commented Sep 1, 2015

hey neo,

it is currently not possible, this feature has been requested since a long time by #30 & #68, perhaps I'll have time to get on it soon..



This comment has been minimized.

sdillinger commented Sep 5, 2015


This is a bit of a hack - but if the alternate searches are limited and know in advance what they are (which is mostly your case) you could add them to the 'display' list so that they are searched. Then in the template you exclude the alternate values.

Like this:
display: ['first_last', 'last_first', 'first_initial_last']
template: '{{first_last}}

'first_last', 'last_first', 'first_initial_last'
Jane Miller, Miller Jane, J Miller

hope this helps.

running-coder added a commit that referenced this issue Sep 13, 2015

Version 2.1.0
New Features
Closes #30 #71 Adding correlativeTemplate to compile the template and soften the search matching mechanism
Closes #67 Adding the possibility to have the {{query}} word replace inside the Ajax Url
Closes #65 Added Bootstrap example

Fixes #54: onSubmit callback was not receiving proper item information
Fixes #58: Debug option is now being considered and will not print if set to false, make sure to use the /dist/jquery.typeahead.min.js version in production
Fixes #62 IE9 doesn't trigger "input" event when text gets removed
Fixes #64 options.template was unable to display "false" or "0" value

This comment has been minimized.


running-coder commented Sep 13, 2015

should now work with the correlativeTemplate option


This comment has been minimized.

neolution-ch commented Sep 16, 2015

We'll look into it. Thank you very much! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment