Checkbox Class
Wraps the specified checkbox input nodes to provide an alternative rendering of checkbox without compromising its functionality. Handles synchronization of the checkbox's state with its new rendering. Also adds highlight/unhighlight on focus/unfocus, update label when checked/unchecked
Imports RAMP Modules:
Constructor
Checkbox
-
node
-
[options]
Parameters:
-
node
JObjecta jQuery object representing the input checkbox node to be wrapped
-
[options]
Object optionalAdditional options
-
[nodeIdAttr]
String optionalName of the "data-" attribute set on the checkbox node to be treated as the checkbox id. If no appropriate "data-" attribute found,
nodeIdAttr
is used directly, failing that, regularid
is used. -
[cssClass]
Object optionalactive
,focus
, andcheck
CSS class to be applied to the Checkbox correspondingly. -
[label]
Object optionalcheck
anduncheck
label texts to be applied to the Checkbox labels. -
[onChnage]
Function optionalA function to be called when the state of the Checkbox changes.
-
Returns:
A control objects allowing to toggle checkbox.
Item Index
Events
Methods
_emit
-
agency
Emits a TOGGLE
event when the checkbox's state is changed.
Parameters:
-
agency
StringSpecified the agency that toggled the Checkbox.
Properties
agency
Object
private
An object specifying possible agencies that can affect the Checkbox.
Example:
agency: {
USER: "USER",
CODE: "CODE"
}
cssClass
Object
active
, focus
, and check
CSS class to be applied to the Checkbox correspondingly.
Example:
cssClass: {
active: "active",
focus: "focused",
check: "checked"
}
event
Object
private
Event names published by the Checkbox
Default: null
Example:
{
TOGGLE: "checkbox/toggle"
}
label
Object
check
and uncheck
label texts to be applied to the Checkbox labels.
Example:
label: {
check: "check",
uncheck: "unchecked"
}
labelNode
JObject
private
Node of the input checkbox label.
Default: null
node
JObject
Node of the input checkbox originally supplied to the Checkbox.
Default: null
nodeIdAttr
String
Name of the "data-*" attribute set on the checkbox node to be treated as the checkbox id.
Default: "id"
onChnage
Function
A function to be called when the state of the Checkbox changes.
Example:
function () { }