du.widgets.checkbox

Module implementing a checkbox.

Requires: d3@v4 du.Widget

Checkbox

du.widgets.checkbox.Checkbox(name[, parent])

The checkbox widget class.
argtypedescription
namestringIdentifier of the legend.
parentobjectParent element to append widget to. If not specified, widget is appended to body. optional

callback

du.widgets.checkbox.Checkbox.callback(func)

Sets callback attached to the checkbox. Must accept one boolean parameter describing the value of the checkbox after the change. By default, no callback is set.
argtypedescription
funcfunctionThe callback to call on checked change.
returndescription
du.widgets.checkbox.CheckboxReference to the current checkbox.

check

du.widgets.checkbox.Checkbox.check(checked)

Sets the checkbox checked. Note that calling this method will also trigger the callback.
argtypedescription
checkedbooleanWhether the checkbox should be checked.
returndescription
du.widgets.checkbox.CheckboxReference to the current checkbox.