Custom Matcher Help

I am would like to use select2 to help with searching through my very long drop down list. The issue I am having is the default search feature fails to find the correct results. Here is an example:

14 x 14 x 1

The search will only find this result if the users enters a space between the “14” and the “x”. I would like to create a custom matcher to search the value attribute and its text value for a match.

Is this possible?

I’ve run into this same issue before, but honestly I’d suggest that you use AJAX and implement server-side filtering, especially if you have a very long list of selections. Generally speaking, there are more options for optimizing these types of searches on the server, anyway.

Thanks for the reply. I was actually able to figure it out. I will post a code snippet tomorrow.

2 Likes

Is this your solution here? https://github.com/select2/select2/issues/1609#issuecomment-342210457