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
Fixes to remove button plugin #1311
Conversation
- keep the button element inside the 'item' element. - allows to use a custom CSS class for the remove-button element, when settings.mode='single'.
- when removing an item the 'item_remove' event was triggered just with setting.mode 'multi' and not with setting.mode 'single'.
- the remove-button plugin was splitted in two functions (for 'multi' and 'single' mode). This led to divergence in behaviour, fixes, and triggered events (856307c). This commit unifies the code, congruently with the rest of the codebase, making the behaviour again more stable and similar, regardless of the mode (single/multi). - the remove-button plugin, when in 'single' mode, was not able to trigger the 'onDelete' callback, preventing from doing checks on the values; while that was possible just witht he 'multi' mode. Now both modes are able to trigger the callback.
Changes Unknown when pulling ea2e931 on Pictor13:fix-remove_button_plugin into ** on selectize:master**. |
I just tried your "remove_button" and the "x" icon just magically appeared, without having to change any of my configuration. Thank you so much! |
Not sure this is working as intended for the case when settings.maxItems=1. If you edit https://github.com/selectize/selectize.js/blob/master/examples/plugins.html#L38 and add maxItems: 1 to the config, your selectize control will look like this: |
UpdateHad no time to check all the little details and the consequences; sorry if this PR stalled.
Bugs
ToDo
To understand(in order to stay consistent and don't have breaking/unintended consequences)
|
@temuri416 that's how it is supposed to look like. WhyIt changes visually because, when you just specify Note: the position of the "x" is maybe a little misaligned, but it is not a bug. Maybe the less file should be adjusted. SolutionIf you wanna get the cards/boxes styling you need to manually force the multi mode via the setting (I didn't notice because in my project I tend to always specify the desired mode rather than making it implicit by combination of settings) By the way....
|
and add an example.
e3e21ba
to
a7db68e
Compare
I fixed the styling. Now looks decent also with single-selects. Is there something more to fix here, or can we merge? |
Referencing the pull-request #1303 because of some insights in its comments, that are useful in evaluating also he changes made in here. |
Stale pull request message |
This replaces the pull request I made for fixing the remove_button plugin, cause of mess I made with the commits (changed the dist/ and not just the src/; and used ugly revert commit to repair).
I didn't squash the commits as each concerns a different fix/detail.
Please refer to pull request "#1151 Fix remove_button plugin when settings.maxItems=1" for details.
I am going to close that one, referring this pull request.
PS - Sorry for taking so much time to recreate it. Hope it will help somebody.