Class sap.ui.commons.CheckBoxModule: sap/ui/commons/CheckBox

extends Control

Provides a box which can be flagged, the box has a label. A check box can either stand alone, or in a group with other check boxes. As an option, the boxes can initially be set to status 'Not Editable'.

Deprecated API:Since version 1.38. Instead, use the sap.m.CheckBox control.

Constructor Summary
new sap.ui.commons.CheckBox(sId?, mSettings?)Constructor for a new CheckBox.
Event Summary
change(oControlEvent)Event is triggered when the control status is changed by the user by flagging or unflagging the checkbox.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.ui.commons.CheckBox.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.commons.CheckBox with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.commons.CheckBox.getMetadata()Returns a metadata object for class sap.ui.commons.CheckBox.
addAriaDescribedBy(vAriaDescribedBy)Adds some ariaDescribedBy into the association ariaDescribedBy.
addAriaLabelledBy(vAriaLabelledBy)Adds some ariaLabelledBy into the association ariaLabelledBy.
attachChange(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the change event of this sap.ui.commons.CheckBox.
bindChecked(oBindingInfo)Binds property checked to model data.
detachChange(fnFunction, oListener)Detaches event handler fnFunction from the change event of this sap.ui.commons.CheckBox.
fireChange(mArguments?)Fires event change to attached listeners.
getAriaDescribedBy()Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.
getAriaLabelledBy()Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
getChecked()Gets current value of property checked.
getEditable()Gets current value of property editable.
getEnabled()Gets current value of property enabled.
getName()Gets current value of property name.
getText()Gets current value of property text.
getTextDirection()Gets current value of property textDirection.
getValueState()Gets current value of property valueState.
getWidth()Gets current value of property width.
removeAllAriaDescribedBy()Removes all the controls in the association named ariaDescribedBy.
removeAllAriaLabelledBy()Removes all the controls in the association named ariaLabelledBy.
removeAriaDescribedBy(vAriaDescribedBy)Removes an ariaDescribedBy from the association named ariaDescribedBy.
removeAriaLabelledBy(vAriaLabelledBy)Removes an ariaLabelledBy from the association named ariaLabelledBy.
setChecked(bChecked)Sets a new value for property checked.
setEditable(bEditable)Sets a new value for property editable.
setEnabled(bEnabled)Sets a new value for property enabled.
setName(sName)Sets a new value for property name.
setText(sText)Sets a new value for property text.
setTextDirection(sTextDirection)Sets a new value for property textDirection.
setValueState(sValueState)Sets a new value for property valueState.
setWidth(sWidth)Sets a new value for property width.
toggle()Inverts the current value of the control.
unbindChecked()Unbinds property checked from model data.
Constructor Detail
new sap.ui.commons.CheckBox(sId?, mSettings?)
Constructor for a new CheckBox.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.

The supported settings are:

  • Properties
  • Events
    • change : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]

In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.

Parameters:
{string}sId? id for the new control, generated automatically if no id is given
{object}mSettings? initial settings for the new control
Deprecated:
Since version 1.38. Instead, use the sap.m.CheckBox control.
Event Detail
change(oControlEvent)
Event is triggered when the control status is changed by the user by flagging or unflagging the checkbox.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{boolean}oControlEvent.getParameters.checked Checks whether the box is flagged or not flagged.
Method Detail
sap.ui.commons.CheckBox.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.commons.CheckBox with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Control.extend.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.commons.CheckBox.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.commons.CheckBox.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
addAriaDescribedBy(vAriaDescribedBy): sap.ui.commons.CheckBox
Adds some ariaDescribedBy into the association ariaDescribedBy.
Parameters:
{string|sap.ui.core.Control}vAriaDescribedBy the ariaDescribedBy to add; if empty, nothing is inserted
Returns:
{sap.ui.commons.CheckBox} Reference to this in order to allow method chaining
addAriaLabelledBy(vAriaLabelledBy): sap.ui.commons.CheckBox
Adds some ariaLabelledBy into the association ariaLabelledBy.
Parameters:
{string|sap.ui.core.Control}vAriaLabelledBy the ariaLabelledBy to add; if empty, nothing is inserted
Returns:
{sap.ui.commons.CheckBox} Reference to this in order to allow method chaining
attachChange(oData?, fnFunction, oListener?): sap.ui.commons.CheckBox
Attaches event handler fnFunction to the change event of this sap.ui.commons.CheckBox.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.commons.CheckBox itself.

Event is triggered when the control status is changed by the user by flagging or unflagging the checkbox.

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.ui.commons.CheckBox itself
Returns:
{sap.ui.commons.CheckBox} Reference to this in order to allow method chaining
bindChecked(oBindingInfo): sap.ui.commons.CheckBox
Binds property checked to model data.

See ManagedObject.bindProperty for a detailed description of the possible properties of oBindingInfo

Parameters:
{object}oBindingInfo The binding information
Returns:
{sap.ui.commons.CheckBox} Reference to this in order to allow method chaining
detachChange(fnFunction, oListener): sap.ui.commons.CheckBox
Detaches event handler fnFunction from the change event of this sap.ui.commons.CheckBox.

The passed function and listener object must match the ones used for event registration.

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Returns:
{sap.ui.commons.CheckBox} Reference to this in order to allow method chaining
fireChange(mArguments?): sap.ui.commons.CheckBox
Fires event change to attached listeners.

Expects the following event parameters:

  • checked of type booleanChecks whether the box is flagged or not flagged.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.commons.CheckBox} Reference to this in order to allow method chaining
getAccessibilityInfo()
See:
{sap.ui.core.Control#getAccessibilityInfo}
getAriaDescribedBy(): sap.ui.core.Control[]
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.
Returns:
{sap.ui.core.Control[]}
getAriaLabelledBy(): sap.ui.core.Control[]
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
Returns:
{sap.ui.core.Control[]}
getChecked(): boolean
Gets current value of property checked.

Contains the state of the control whether it is flagged with a check mark, or not

Default value is false.

Returns:
{boolean} Value of property checked
getEditable(): boolean
Gets current value of property editable.

Specifies whether the user shall be allowed to select the check box.

Default value is true.

Returns:
{boolean} Value of property editable
getEnabled(): boolean
Gets current value of property enabled.

Using this property, the control could be disabled, if required.

Default value is true.

Returns:
{boolean} Value of property enabled
getName(): string
Gets current value of property name.

The 'name' property to be used in the HTML code, for example for HTML forms that send data to the server via submit.

Returns:
{string} Value of property name
getText(): string
Gets current value of property text.

Defines the text displayed next to the check box

Returns:
{string} Value of property text
getTextDirection(): sap.ui.core.TextDirection
Gets current value of property textDirection.

The value can be set to LTR or RTL. Otherwise, the control inherits the text direction from its parent control.

Default value is Inherit.

Returns:
{sap.ui.core.TextDirection} Value of property textDirection
getValueState(): sap.ui.core.ValueState
Gets current value of property valueState.

Accepts the core enumeration ValueState.type that supports 'None', 'Error', 'Warning' and 'Success'.

Default value is None.

Returns:
{sap.ui.core.ValueState} Value of property valueState
getWidth(): sap.ui.core.CSSSize
Gets current value of property width.

The width can be set to an absolute value. If no value is set, the control width results from the text length.

Returns:
{sap.ui.core.CSSSize} Value of property width
removeAllAriaDescribedBy(): sap.ui.core.Control[]
Removes all the controls in the association named ariaDescribedBy.
Returns:
{sap.ui.core.Control[]} An array of the removed elements (might be empty)
removeAllAriaLabelledBy(): sap.ui.core.Control[]
Removes all the controls in the association named ariaLabelledBy.
Returns:
{sap.ui.core.Control[]} An array of the removed elements (might be empty)
removeAriaDescribedBy(vAriaDescribedBy): sap.ui.core.Control
Removes an ariaDescribedBy from the association named ariaDescribedBy.
Parameters:
{int|string|sap.ui.core.Control}vAriaDescribedBy The ariaDescribedByto be removed or its index or ID
Returns:
{sap.ui.core.Control} the removed ariaDescribedBy or null
removeAriaLabelledBy(vAriaLabelledBy): sap.ui.core.Control
Removes an ariaLabelledBy from the association named ariaLabelledBy.
Parameters:
{int|string|sap.ui.core.Control}vAriaLabelledBy The ariaLabelledByto be removed or its index or ID
Returns:
{sap.ui.core.Control} the removed ariaLabelledBy or null
setChecked(bChecked): sap.ui.commons.CheckBox
Sets a new value for property checked.

Contains the state of the control whether it is flagged with a check mark, or not

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

Parameters:
{boolean}bChecked New value for property checked
Returns:
{sap.ui.commons.CheckBox} Reference to this in order to allow method chaining
setEditable(bEditable): sap.ui.commons.CheckBox
Sets a new value for property editable.

Specifies whether the user shall be allowed to select the check box.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Parameters:
{boolean}bEditable New value for property editable
Returns:
{sap.ui.commons.CheckBox} Reference to this in order to allow method chaining
setEnabled(bEnabled): sap.ui.commons.CheckBox
Sets a new value for property enabled.

Using this property, the control could be disabled, if required.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Parameters:
{boolean}bEnabled New value for property enabled
Returns:
{sap.ui.commons.CheckBox} Reference to this in order to allow method chaining
setName(sName): sap.ui.commons.CheckBox
Sets a new value for property name.

The 'name' property to be used in the HTML code, for example for HTML forms that send data to the server via submit.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
{string}sName New value for property name
Returns:
{sap.ui.commons.CheckBox} Reference to this in order to allow method chaining
setText(sText): sap.ui.commons.CheckBox
Sets a new value for property text.

Defines the text displayed next to the check box

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
{string}sText New value for property text
Returns:
{sap.ui.commons.CheckBox} Reference to this in order to allow method chaining
setTextDirection(sTextDirection): sap.ui.commons.CheckBox
Sets a new value for property textDirection.

The value can be set to LTR or RTL. Otherwise, the control inherits the text direction from its parent control.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Inherit.

Parameters:
{sap.ui.core.TextDirection}sTextDirection New value for property textDirection
Returns:
{sap.ui.commons.CheckBox} Reference to this in order to allow method chaining
setValueState(sValueState): sap.ui.commons.CheckBox
Sets a new value for property valueState.

Accepts the core enumeration ValueState.type that supports 'None', 'Error', 'Warning' and 'Success'.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is None.

Parameters:
{sap.ui.core.ValueState}sValueState New value for property valueState
Returns:
{sap.ui.commons.CheckBox} Reference to this in order to allow method chaining
setWidth(sWidth): sap.ui.commons.CheckBox
Sets a new value for property width.

The width can be set to an absolute value. If no value is set, the control width results from the text length.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
{sap.ui.core.CSSSize}sWidth New value for property width
Returns:
{sap.ui.commons.CheckBox} Reference to this in order to allow method chaining

Inverts the current value of the control.

Returns:
{sap.ui.commons.CheckBox}
unbindChecked(): sap.ui.commons.CheckBox
Unbinds property checked from model data.
Returns:
{sap.ui.commons.CheckBox} Reference to this in order to allow method chaining