- add "input" class to select 2 (essentially use as autocomplete)
- allows select2 to be used for as auto-complete for an input form
- just use pass "select2Class: 'input'" as a param object property
your patch is against 3.2 instead of master, so its really hard to read and cannot be merged....
Thanks for the reply Igor - have you tried the code? If you are interested in using it, I'd be happy to implement the new functionality on the master copy.
this sounds very useful! +1 to @Evan-R and would be happy to lend a hand.
can you guys create a jsfiddle so i can take a look. very limited on time unfortunately right now
Hey @ivaynberg I just put up a jsfiddle. Right now it submits the form on select or enter, but I guess we could allow a function to be passed there instead. Anyway, please take a look:
@leoromanovsky if you are interested in helping out, and Igor wants to use it in a future release of the project, I'll merge this over to the current master copy, and maybe we can discuss some ways of improving it, such as my suggestions, but perhaps other as well :)
how is this different then a single select with createSearchChoice that returns the input (like in the tags)?
*edit - scratch the first part, this is not the case *
On "enter" (I guess I should also add different "tab" behaviour), the "input" class select2 simply uses the current value that the user has typed without needing to select the custom choice from the list
Actually, I suppose this is more or less way too large of an update now to justify inclusion. Sorry about that.
i think a better way to do this would be how multiselect works. you have the actual input field you are typing into right away - not in the dropdown
Thanks Igor - I will take a look into that, that may indeed be a better way. The reason that I came up with this methodology originally to address my needs was because I did not want the custom selection box showing up, and "enter" was needing to wait for the ajax request to populate the suggestions field, so response times were often laggy. Is there a way to make the "custom suggestion" show up before the ajax fetched suggestions?
i think this can all be accomplished by using a combination of createSearchChoice, maxSelectionSize:1, and selectBlur: true options in combination with a multiselect box.