vsn4ik / bootstrap-checkbox

A checkbox component based on Bootstrap framework.

Home Page:https://vsn4ik.github.io/bootstrap-checkbox/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Disable addon for specific checkboxes

Maelstorm1973 opened this issue · comments

I would like a feature to disable this addon for specific checkboxes. Something like data-check-disable="true" within the input element would do nicely.

After poking around in the code, I got it to work. And it works quite nicely. This code has three new options you can add. The first one sets on demand mode. With on demand mode, only checkboxes which has the data-switch-enable="true" attribute will show the switch. With on-demand mode turned off (the default), it works normally, but can be turned off for individual controls by adding the attribute data-switch-disable="true".

To turn on the new On-Demand feature:

$(':checkbox').checkboxpicker({
	onDemand: true,
});

To turn off the switch for one control when On Demand is off...
<input type="checkbox" data-switch-disable="true">

To turn on the switch for one control when On Demand is on...
<input type="checkbox" data-switch-enable="true">

Hopefully, someone will find this useful.
bootstrap-checkbox.txt

Yes ! Your code that I just downloaded from the txt is exactly what I needed, and my requirement was fully satisfied.

Thank you and have a great day