selectize.js
selectize.js copied to clipboard
Linked / Shared list between multiple selectize
Hello,
I would like to know if there a way to share the same "list" of option between multiple selectize, and if I select an item from a selectize A, this item is automatically removed from all the list of others selectize ?
For example, here the item "[email protected]" should not appear / be selectable in the second selectize as it's already selected in the first input.

Here is what I'm doing : I remove the last item added from others list.
var $selectizeResponsables = $('#project_form_responsables').selectize(opts);
var $selectizeTeamWrite = $('#project_form_team_write').selectize(opts);
var $selectizeTeamRead = $('#project_form_team_read').selectize(opts);
var selectizeResponsables = $selectizeResponsables[0].selectize;
var selectizeTeamWrite = $selectizeTeamWrite[0].selectize;
var selectizeTeamRead = $selectizeTeamRead[0].selectize;
// Prevent from adding same item on others fields
selectizeResponsables.on('item_add', function(value, $item) {
selectizeTeamWrite.removeItem(value);
selectizeTeamRead.removeItem(value);
});
selectizeTeamWrite.on('item_add', function(value, $item) {
selectizeResponsables.removeItem(value);
selectizeTeamRead.removeItem(value);
});
selectizeTeamRead.on('item_add', function(value, $item) {
selectizeResponsables.removeItem(value);
selectizeTeamWrite.removeItem(value);
});
closing stale issues older than one year. If this issue was closed in error please message the maintainers. All issues must include a proper title, description, and examples.