Select2 4.0.x Multi Checkboxes JS Plugin
Asked Answered
M

0

3

I'm using the Select2 control along with the Select2.Multi-checkboxes.JS plugin to allow multi-checkbox selection.

The following demo shows that the control works properly with Select2 3.x:

http://jsfiddle.net/wasikuss/gx93rwnk/

But when I cloned from this my own fiddle with Select2 4.0.x it stopped working. The checkboxes are no longer presented. What's the issue?

http://jsfiddle.net/oa435z7s/

I copied all the elements from Fiddle 1 to Fiddle 2 by doing a direct Fork (Clone). Nothing was changed manually in the code. I only deleted the prior Select2 CSS/JS and replaced them with 4.0.5. The Select2-MultiCheckboxes JS is exactly the same.

Also here's a JSFiddle where I updated the Raw Multi-Checkbox JS reference, the previous one had a Version 3.5 reference in its name: https://raw.githubusercontent.com/wasikuss/select2-multi-checkboxes/master/select2.multi-checkboxes.js I assume this is the latest one?

http://jsfiddle.net/oa435z7s/2/ This is even worse.

Is there a new version of Select2.Multi-Checkboxes.JS that works with Select2 4.0.x?

Menorca answered 10/9, 2018 at 18:22 Comment(9)
This fiddle uses Select2 4.0.3: jsfiddle.net/wasikuss/7ak9skbbPalmary
Could you summarize the changes?Menorca
I just find the right version to use, and also put the in the right loading order...for example this is your second fiddle with the updates jsfiddle.net/oa435z7s/8Palmary
This second fiddle "with the updates" doesn't work. You can see it doesn't show checkboxes, for example.Menorca
It was just a css issue, jsfiddle.net/oa435z7s/10Palmary
Thanks, is there a way to customize that header "1 > 6 total"?Menorca
Yeah, but you have to modify the plugin directly, like(check the line 67 of the javascript sandbox) jsfiddle.net/oa435z7s/13Palmary
when using the above with select2 4.0.6-rc.1, it gives this error when any option is selected: Uncaught TypeError: Cannot set property 'selected' of undefined at d.select (select2.min.js:1)Rilda
also, @Palmary can you please put the fiddle link as an answer to this question as any other who has this problem can refer to it.Rilda

© 2022 - 2024 — McMap. All rights reserved.