Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get paste working with select2 4.0 to insert multiple items

Paste was working in previous versions of select2, taking tokenSeparator in account to split pasted term into multiple tags.

Now, I just can't get it running anymore.

Here's how I'm calling select2:

$('select').select2({
  tags: true,
  multiple: true,
  tokenSeparators: [',', ' '],
  width: 200
 });

Example: http://codepen.io/anon/pen/oXoXqO . Try to paste: Gods,Angels,Devils

I also tried to use the tokenizer method, as described here: Auto tokenize last item in pasted string using select2, but got this error: select2.js:3503 Uncaught TypeError: Cannot read property 'term' of undefined

like image 962
Eric Saboia Avatar asked Jun 08 '26 20:06

Eric Saboia


1 Answers

This is a known issue at select2 4.0.0, reported here: https://github.com/select2/select2/issues/3458

like image 78
Eric Saboia Avatar answered Jun 11 '26 11:06

Eric Saboia