Selectize plug-in, multiple values, bug in editor.selectize.js?

Selectize plug-in, multiple values, bug in editor.selectize.js?

BonDottsBonDotts Posts: 3Questions: 1Answers: 1

In it's current state, if you try to use the selectize plug-in with multiple values (i.e. a comma delimited list), when you edit the field, you do not get what is currently selected in the input box. I believe the set method in the plug-in code isn't accounting for the delimiter and is only passing back the full string. I hard coded my delimiter into the plug-in and it now works...

from:
set: function ( conf, val ) {
return conf._selectize.setValue( val );
},

to:

set: function ( conf, val ) {
return conf._selectize.setValue( val.split(",") );
},

I'm not sure if there is a way to pass the delimiter specified in the selectize opts (since hard coding is bad), but I wanted to make you aware of it.

Replies

  • allanallan Posts: 63,839Questions: 1Answers: 10,518 Site admin

    Generally I wouldn't expect that to be be needed with Editor - if you are using selectize to edit an array, would you not be passing in an array of data rather than a string? If you are passing in a string, would you not also need to change the get to join the data from an array into a string so it is consistent outside of Selectize?

    Allan

This discussion has been closed.