Closed longfeide2008 closed 5 years ago
Related to bootstrap-switch you should use a method from bootstrap-switch like $('input[name="my-checkbox"]').bootstrapSwitch('state', true);
.
Docs: https://bttstrp.github.io/bootstrap-switch/methods.html
Related to bootstrap-switch you should use a method from bootstrap-switch like
$('input[name="my-checkbox"]').bootstrapSwitch('state', true);
.Docs: https://bttstrp.github.io/bootstrap-switch/methods.html
Maybe I didn't describe my problem clearly.
I made a test page
Original state: // $("[name='my-checkbox']").bootstrapSwitch('state', true);
Instantiate: $("[name='my-checkbox']").bootstrapSwitch('state', true);
The test examples are as follows:
https://github.com/longfeide2008/bootstrap-switch-test/archive/master.zip
Try this
"drawCallback": (function () {
// 初始化启用禁用按钮
$('input[name="my-checkbox"]').bootstrapSwitch({
'size': 'small',
'onColor': 'success',
'offColor': 'danger'
});
$('input[name="my-checkbox"]:checked').bootstrapSwitch('state', true);
})
This behavior is a bug from bootstrap-switch.
$('input[name="my-checkbox"]').bootstrapSwitch({ 'size': 'small', 'onColor': 'success', 'offColor': 'danger' }); $('input[name="my-checkbox"]:checked').bootstrapSwitch('state', true);
Thank you very much. Will you build some methods into Adminlte? Include bootstrap-switch because these are very basic.
I looked over bootstrap-switch it's nice, I'll add this to AdminLTE v3 😄
我查看了bootstrap-switch,这很好,我将其添加到AdminLTE v3 😄
我查看了bootstrap-switch,这很好,我将其添加到AdminLTE v3 😄
Your attitude makes me feel very surprised. I like AdminLte more and more, including your group of lovely developers. I also hope you can work happily and live seriously!
iCheck: There are also these features that I hope you can build into DataTables.
You can place literally anything in datatables but it depends on what you want to display. If you want to use icheck-bootstrap you need for any checkbox an unique id.
I've added a bootstrap-switch demo in my PR #2256 and created a theme for it.
Issue type:
Environment:
Description:
I want to add a switch button to the form.
example:
I follow the official documentation to include the dependency library.
Instantiation:
But I found the result to be wrong,All are OFF.
Comment out drawCallback,The result is correct,But there is no style.
I need to use bootstrap-switch in AdminLTE DataTables.