WTUI Docs

WTUI  1.0.0

WTUI Docs > WTUI > WTUI.CheckboxGroupControl
Search:
 
Filters

Class WTUI.CheckboxGroupControl

A Group of checkboxes

Tag

<wtui:control type="WTUI.CheckboxGroupControl"/>

The tag for WTUI.CheckboxGroupControl

Example:

<wtui:control type="WTUI.CheckboxGroupControl" id="exampleid">
  <wtui:option value="1">One</wtui:option>
  <wtui:option value="2">Two</wtui:option>
</wtui:control>
Parameters:
id <String> (optional) The id of the checkbox group
name <String> (optional) The name of the control if it is used within a form
options <String> (optional) A JSON encoded array of options
value <String> (optional) The value of the control
onclick <Function>
onchange <Function>

Methods

getCheckedText

String getCheckedText ( )

Get a comma separated list of the labels of the checked items

Returns: String
A comma separated list of the labels of checked items

getValue

String getValue ( )

Get the value

Returns: String
The value of the control

reset

void reset ( )

Reset the control to its original vlaue

Returns: void

setOptions

void setOptions ( options )

Set the options for the checkboxes

Example:
 
WTUIComponent('checkboxgroupid').setOptions([{"label": "option 1", "value": 1}, {"label": "option 2", "value": 2}]);
Parameters:
options <object> (Array) An array of objects, each object with 'label' and 'value' attributes
Returns: void

setValue

void setValue ( value )

Set the value

Parameters:
value <String> The value
Returns: void

Events

change

change ( value )
Fired when the value of the checkbox group changes

Example:
WTUIComponent('checkboxid').on('change', function() {
  alert('checkbox group value changed');
}
Parameters:
value <String> The new value of the control

click

click ( value )
Fired when a checkbox in the group is clicked

Example:
WTUIComponent('checkboxid').on('click', function() {
  alert('checkbox clicked');
}
Parameters:
value <String> The value of the checkbox clicked

WTUI