-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closes #129, allows duplicate values #324
Conversation
Hey @jbrooksuk, thanks for this! We coincidentally tried updating our selectize earlier today. We noticed that the port of the solution from #129 no longer worked. Here was the case that was breaking: <select>
<option value="1" selected="selected">Option</option>
<option value="1" selected="selected">Option</option>
</select> $('select').selectize({
mode: 'multi',
duplicates: true
}); The logic for handling optgroups is short circuiting L2450, causing only distinct items to be added to selectize. I believe that we should only return if duplicates are not being allowed, however I'm not entirely sure of all the cases surrounding this logic. |
Oh damn. I completely forgot about optgroups. If you make the change that you suggested, does it fix it? |
It seems to work for both selects with no optgroups and those with. I haven't had a chance to dig any deeper in to the logic around all the cases around L2450. I should have some free time tomorrow, though. |
@ohaibbq ok, since I don't use optgroups, I don't really have any test cases. If you could provide me with some examples I'm happy to take a look. I'd rather provide @brianreavis with a full PR to add this feature. |
@brianreavis have you had a chance to take a look yet? |
To ease the process of merging the pull request the owner has requested you exclude the generated files in pull requests in the readme. |
ok, o try this code and it do not work until..... until i do not change Selectize.prototype.search. in fact, if we allow same items few times, we also should show used elements in list available options before:
after:
|
Hello, |
1 similar comment
Hello, |
Closing due to conflicts and no time to make it work. |
I broke down and had to add this in! For duplicates to work, you must have the
mode
set tomulti
, otherwise it wouldn't make sense.Documentation changes to follow.
I've included the compiled files too. Since I only added the
duplicates
option, I don't know why there are so many other changes? If you can figure this out, I can change the commits.