You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Click the switch to toggle from indeterminate to Off
Bug: expected onSwitchChange to fire with state = false
Note: Toggling the switch from indeterminate to On works as expected; ie: onSwitchChange fires with state = true. The root issue is that this.options.state is initialized to false when this.options.indeterminate = true, so switching the switch to the Off state already has options.state = false, and thus no onSwitchChange event is fired.
To fix in bootstrap-switch.js version 3.3.2, add these lines:
Alternative temporary fix approach during intialisation, if the bootstrap-switch.js file is treated as an asset that should not be modified:
$(node).find("input.bootstrap-switch").each(function(){varinput=$(this);input.bootstrapSwitch();if(input.prop("indeterminate")){// Temporary fix for state change detection not working if switch is changed from indeterminate to// off, cf. https://github.com/Bttstrp/bootstrap-switch/issues/541vardata=input.data("bootstrap-switch");if(data){data.options.state=undefined;}}});
Works fine with the v4 branch (last commit at the time of this comment was 88cdb64).
To reproduce:
To fix in bootstrap-switch.js version 3.3.2, add these lines:
The text was updated successfully, but these errors were encountered: