The CheckBox control allows the user to select one or multiple items from a list. To select each item the user has to select the square box in front of it.
Event Summary
select(oControlEvent)Event is triggered when the control status is changed by the user by selecting or deselecting the checkbox. Method Summary
sap.m.CheckBox.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.m.CheckBox with name sClassName
and enriches it with the information contained in oClassInfo
. addAriaDescribedBy(vAriaDescribedBy)Adds some ariaDescribedBy into the association ariaDescribedBy
. addAriaLabelledBy(vAriaLabelledBy)Adds some ariaLabelledBy into the association ariaLabelledBy
. attachSelect(oData?, fnFunction, oListener?)Attaches event handler fnFunction
to the select
event of this sap.m.CheckBox
. detachSelect(fnFunction, oListener)Detaches event handler fnFunction
from the select
event of this sap.m.CheckBox
. fireSelect(mArguments?)Fires event select
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
. getEnabled()Gets current value of property enabled
. getName()Gets current value of property name
. getText()Gets current value of property text
. getWidth()Gets current value of property width
. removeAriaDescribedBy(vAriaDescribedBy)Removes an ariaDescribedBy from the association named ariaDescribedBy
. removeAriaLabelledBy(vAriaLabelledBy)Removes an ariaLabelledBy from the association named ariaLabelledBy
. 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
. setTabIndex(iTabIndex)Sets the tab index of the control setText(sText)Sets a new value for property text
. setTextAlign(sTextAlign)Sets a new value for property textAlign
. setValueState(sValueState)Sets a new value for property valueState
. setWidth(sWidth)Sets a new value for property width
. addStyleClass,
allowTextSelection,
attachBrowserEvent,
attachValidateFieldGroup,
checkFieldGroupIds,
clone,
detachBrowserEvent,
detachValidateFieldGroup,
fireValidateFieldGroup,
getBusy,
getBusyIndicatorDelay,
getControlsByFieldGroupId,
getFieldGroupIds,
getIdForLabel,
getRenderer,
getVisible,
hasStyleClass,
invalidate,
isBusy,
onAfterRendering,
onBeforeRendering,
placeAt,
removeStyleClass,
rerender,
setBusy,
setBusyIndicatorDelay,
setFieldGroupIds,
setVisible,
toggleStyleClass,
triggerValidateFieldGroup $,
addCustomData,
addDependent,
addEventDelegate,
applyFocusInfo,
bindElement,
data,
destroy,
destroyCustomData,
destroyDependents,
destroyLayoutData,
destroyTooltip,
enhanceAccessibilityState,
exit,
findElements,
fireEvent,
focus,
getCustomData,
getDependents,
getDomRef,
getElementBinding,
getFocusDomRef,
getFocusInfo,
getInterface,
getLayoutData,
getMetadata,
getTooltip,
getTooltip_AsString,
getTooltip_Text,
indexOfCustomData,
indexOfDependent,
insertCustomData,
insertDependent,
prop,
removeAllCustomData,
removeAllDependents,
removeCustomData,
removeDependent,
removeEventDelegate,
setLayoutData,
setTooltip,
toString,
unbindElement addAggregation,
addAssociation,
applySettings,
attachFormatError,
attachModelContextChange,
attachParseError,
attachValidationError,
attachValidationSuccess,
bindAggregation,
bindContext,
bindObject,
bindProperty,
destroyAggregation,
detachFormatError,
detachModelContextChange,
detachParseError,
detachValidationError,
detachValidationSuccess,
findAggregatedObjects,
fireFormatError,
fireModelContextChange,
fireParseError,
fireValidationError,
fireValidationSuccess,
getAggregation,
getAssociation,
getBinding,
getBindingContext,
getBindingInfo,
getBindingPath,
getEventingParent,
getId,
getModel,
getObjectBinding,
getOriginInfo,
getParent,
getProperty,
hasModel,
indexOfAggregation,
insertAggregation,
isBound,
isInvalidateSuppressed,
isTreeBinding,
propagateMessages,
removeAggregation,
removeAllAggregation,
removeAllAssociation,
removeAssociation,
setAggregation,
setAssociation,
setBindingContext,
setModel,
setProperty,
unbindAggregation,
unbindContext,
unbindObject,
unbindProperty,
validateAggregation,
validateProperty Constructor Detail
new sap.m.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
- Aggregations
- Events
- select : 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? | The ID for the new control, generated automatically if no ID is given |
{object} | mSettings? | The Initial settings for the new control |
Event Detail
select(oControlEvent)
Event is triggered when the control status is changed by the user by selecting or deselecting the checkbox.
Parameters:
Method Detail
sap.m.CheckBox.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.m.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 |
Returns a metadata object for class sap.m.CheckBox.
Returns:
Adds some ariaDescribedBy into the association ariaDescribedBy
.
Parameters:
{string|sap.ui.core.Control} | vAriaDescribedBy | the ariaDescribedBy to add; if empty, nothing is inserted |
Returns:
Adds some ariaLabelledBy into the association ariaLabelledBy
.
Parameters:
{string|sap.ui.core.Control} | vAriaLabelledBy | the ariaLabelledBy to add; if empty, nothing is inserted |
Returns:
Attaches event handler
fnFunction
to the
select
event of this
sap.m.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.m.CheckBox
itself.
Event is triggered when the control status is changed by the user by selecting or deselecting 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.m.CheckBox itself |
Returns:
Detaches event handler
fnFunction
from the
select
event of this
sap.m.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:
Fires event
select
to attached listeners.
Expects the following event parameters:
selected
of type boolean
Checks whether the CheckBox is marked or not .
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
getAccessibilityInfo()
See:
{sap.ui.core.Control#getAccessibilityInfo} |
getActiveHandling(): boolean
Gets current value of property
activeHandling
.
Flag to switch on activeHandling, when it is switched off, there will be no visual changes on active state. Default value is 'true'
Default value is true
.
Returns:
{boolean} | Value of property activeHandling |
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy
.
Returns:
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy
.
Returns:
getEditable(): boolean
Gets current value of property
editable
.
Specifies whether the user shall be allowed to edit the state of the checkbox
Default value is true
.
- Since:
- 1.25
Returns:
{boolean} | Value of property editable |
getEnabled(): boolean
Gets current value of property
enabled
.
Disables the Checkbox. Disabled controls are not interactive and are rendered differently according to the theme.
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 |
getSelected(): boolean
Gets current value of property
selected
.
Stores the state of the checkbox whether it is selected or not.
Default value is false
.
Returns:
{boolean} | Value of property selected |
getTabIndex(): int
Returns the CheckBox`s tab index.
- Since:
- 1.22
Returns:
{int} | iTabIndex for Checkbox |
getText(): string
Gets current value of property
text
.
Defines the text displayed next to the checkbox
Returns:
{string} | Value of property text |
Gets current value of property
textAlign
.
Aligns the text of the checkbox. Available alignment settings are "Begin", "Center", "End", "Left", and "Right".
Default value is Begin
.
Returns:
Gets current value of property
textDirection
.
Options for the text direction are RTL and LTR. Alternatively, the control can inherit the text direction from its parent container.
Default value is Inherit
.
Returns:
Gets current value of property
valueState
.
Accepts the core enumeration ValueState.type that supports 'None', 'Error', 'Warning' and 'Success'.
Default value is None
.
- Since:
- 1.38
Returns:
Gets current value of property
width
.
Width of the checkbox`s label
Default value is
.
Returns:
Removes all the controls in the association named ariaDescribedBy
.
Returns:
Removes all the controls in the association named ariaLabelledBy
.
Returns:
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:
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:
Sets a new value for property
activeHandling
.
Flag to switch on activeHandling, when it is switched off, there will be no visual changes on active state. Default value is 'true'
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Parameters:
{boolean} | bActiveHandling | New value for property activeHandling |
Returns:
Sets a new value for property
editable
.
Specifies whether the user shall be allowed to edit the state of the checkbox
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 |
- Since:
- 1.25
Returns:
Sets a new value for property
enabled
.
Disables the Checkbox. Disabled controls are not interactive and are rendered differently according to the theme.
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:
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:
Sets the tab index of the control
Parameters:
{int} | iTabIndex | The tab index should be greater than or equal -1 |
- Since:
- 1.16
Returns:
Sets a new value for property
text
.
Defines the text displayed next to the checkbox
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:
Sets a new value for property
textAlign
.
Aligns the text of the checkbox. Available alignment settings are "Begin", "Center", "End", "Left", and "Right".
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Begin
.
Parameters:
Returns:
Sets a new value for property
textDirection
.
Options for the text direction are RTL and LTR. Alternatively, the control can inherit the text direction from its parent container.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Inherit
.
Parameters:
Returns:
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:
- Since:
- 1.38
Returns:
Sets a new value for property
width
.
Width of the checkbox`s label
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is
.
Parameters:
Returns: