Filter options based on email

10 views
Skip to first unread message

joel.w...@gmail.com

unread,
Aug 5, 2015, 1:32:19 PM8/5/15
to select2
Is it possible to setup a select2 box to use the `minimumInputLength` with emails? What I mean, is it only filters based on the email text before the "@". So you couldn't filter by typing in "gmail.com" or ".com", etc.

Kevin Brown

unread,
Aug 6, 2015, 12:29:27 PM8/6/15
to joel.w...@gmail.com, select2

This doesn’t actually sound like a case for `minimumInputLength` (though that may be useful just to avoid extra requests). Filtering out results and determining how they are matched should be done using a custom `matcher`.

 

http://select2.github.io/examples.html#matcher

 

The incoming search term as well as the text of the option are both available there. So you should be able to split the email address and only do a search on the account, so the domain won’t ever be matched. If you are connected to a remote data source, you should be able to do the filtering on that end.

 

Reply all
Reply to author
Forward
0 new messages