Switcher Widget

This widget originates from the "switcher" mode of the existing checkbox widget. Because of the increased complexity of the old widget code, the switcher mode is now server by this file. Apply the widget in a parent container and it will search and convert all the checkbox/radio instances into switchers.

Options

On State | data-switcher-on-state | String | Optional

Define the content of the "on" state.

Off State | data-switcher-off-state | String | Optional

Define the content of the "off" state.

Selector | data-switcher-selector | String | Optional

Set the selector of the checkboxes to be converted to switcher instances. It defaults to input:checkbox.

Methods

Checked

// Set the checked value of the single checkbox selection (no change event will be triggered!).
$('table input:checkbox').switcher('checked', true);

Examples

In the following example the checkbox element will be converted into a single-checkbox instance.

<div class="wrapper" data-gx-widget="switcher">
  <input type="checkbox" />
</div>
Source:
To Do:
  • Add method for disabling the switcher widget (e.g. $('#my-switcher').switcher('disabled', true));