Skip to content
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

Feature Request: Disable addon for specific checkboxes #43

Open
Maelstorm1973 opened this issue Jun 18, 2021 · 2 comments
Open

Feature Request: Disable addon for specific checkboxes #43

Maelstorm1973 opened this issue Jun 18, 2021 · 2 comments

Comments

@Maelstorm1973
Copy link

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.

@Maelstorm1973
Copy link
Author

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

@rodrigomoncayo
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants