du.widgets.checkbox.Checkbox(name[, parent])
The checkbox widget class.
| arg | type | description |
|---|
| name | string | Identifier of the legend. |
| parent | object | Parent element to append widget to. If not specified, widget is appended to body. optional |
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.
| arg | type | description |
|---|
| func | function | The callback to call on checked change. |
| return | description |
|---|
du.widgets.checkbox.Checkbox | Reference to the current checkbox. |
du.widgets.checkbox.Checkbox.check(checked)
Sets the checkbox checked. Note that calling this method will also trigger the callback.
| arg | type | description |
|---|
| checked | boolean | Whether the checkbox should be checked. |
| return | description |
|---|
du.widgets.checkbox.Checkbox | Reference to the current checkbox. |