I'm developing a choice widget that should be able to show groups of checkboxes as selectable items.
Some of them would be readonly, no problem with those.
Issue1: Some though, must be uncheckable by the user, before submitting the form. But JQ Select2 only shows the inputs inside, not allowing me to click on them.
This is my code so far. Select2 with inner checkboxes Demo
Here's the initialization, start reading from the bottom.
$(document).ready(function() {
var $choice = colonizacion.integrateSelect2();
colonizacion.addHiddenValueUpdater($choice);
});
The HTML, brings the checkbox options in a container div's data-options attribute, which gets parsed and rendered as selectable optoins.
Issue2: another issue is that if the checkbox group contains more than one checkbox, the jqselect2 doesn't re-dimension itself, shwing just the 1st one.
The Alternative I can think of, without knowing the internals of JQSelect2 is to trigger the generation of the checkboxes group DOM elements outside the JQSelect2 as regular inputs, returning no markup, so it'd be empty. But that's nasty.