class sap.ui.commons.TriStateCheckBox

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/commons/TriStateCheckBox
Application Component: CA-UI5-CTR

TriStateCheckBox to reflect mixed state for checkboxes. The control can display three states, namely checked, unchecked and mixed. However, mixed state cannot be directly reached by user interaction on the particular control. It can be only set by the control's public toggle function, to make a behaviour possible which is e.g. required in checkbox trees.


Constructor

Constructor for a new TriStateCheckBox.

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

new sap.ui.commons.TriStateCheckBox(sId?, mSettings?)
Param Type Default Value Description
sId? string

id for the new control, generated automatically if no id is given

mSettings? object

initial settings for the new control


Properties

Name Type Default Value Description
editable boolean true

Specifies whether the user shall be allowed to flag the check box

Visibility: public
enabled boolean true

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

Visibility: public
selectionState sap.ui.commons.TriStateCheckBoxState Unchecked

Defines the states of the checkbox

Visibility: public
text string

Defines the text displayed next to the check box

Visibility: public
textDirection sap.ui.core.TextDirection Inherit

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

Visibility: public
valueState sap.ui.core.ValueState None

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

Visibility: public
width sap.ui.core.CSSSize

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

Visibility: public

Events Overview

Event Description
change

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

change

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

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
selectionState string

Checks whether the box is flagged or not flagged.


Methods Overview

Method Description
attachChange

Attaches event handler fnFunction to the change event of this sap.ui.commons.TriStateCheckBox.

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.TriStateCheckBox itself.

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

detachChange

Detaches event handler fnFunction from the change event of this sap.ui.commons.TriStateCheckBox.

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

sap.ui.commons.TriStateCheckBox.extend

Creates a new subclass of class sap.ui.commons.TriStateCheckBox 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.

fireChange

Fires event change to attached listeners.

getEditable

Gets current value of property editable.

Specifies whether the user shall be allowed to flag the check box

Default value is true.

getEnabled

Gets current value of property enabled.

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

Default value is true.

sap.ui.commons.TriStateCheckBox.getMetadata

Returns a metadata object for class sap.ui.commons.TriStateCheckBox.

getSelectionState

Gets current value of property selectionState.

Defines the states of the checkbox

Default value is Unchecked.

getText

Gets current value of property text.

Defines the text displayed next to the check box

getTextDirection

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.

getValueState

Gets current value of property valueState.

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

Default value is None.

getWidth

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.

setEditable

Sets a new value for property editable.

Specifies whether the user shall be allowed to flag 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.

setEnabled

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.

setSelectionState

Sets a new value for property selectionState.

Defines the states of the checkbox

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

Default value is Unchecked.

setText

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.

setTextDirection

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.

setValueState

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.

setWidth

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.

toggle

Method called whenever a user clicks on a tri-state checkbox

attachChange

Attaches event handler fnFunction to the change event of this sap.ui.commons.TriStateCheckBox.

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.TriStateCheckBox itself.

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

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.commons.TriStateCheckBox itself

detachChange

Detaches event handler fnFunction from the change event of this sap.ui.commons.TriStateCheckBox.

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

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

sap.ui.commons.TriStateCheckBox.extend

Creates a new subclass of class sap.ui.commons.TriStateCheckBox 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.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

fireChange

Fires event change to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

selectionState string

Checks whether the box is flagged or not flagged.

getEditable

Gets current value of property editable.

Specifies whether the user shall be allowed to flag the check box

Default value is true.

getEnabled

Gets current value of property enabled.

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

Default value is true.

sap.ui.commons.TriStateCheckBox.getMetadata

Returns a metadata object for class sap.ui.commons.TriStateCheckBox.

getSelectionState

Gets current value of property selectionState.

Defines the states of the checkbox

Default value is Unchecked.

getText

Gets current value of property text.

Defines the text displayed next to the check box

getTextDirection

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.

getValueState

Gets current value of property valueState.

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

Default value is None.

getWidth

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.

setEditable

Sets a new value for property editable.

Specifies whether the user shall be allowed to flag 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.

Param Type DefaultValue Description
bEditable boolean true

New value for property editable

setEnabled

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.

Param Type DefaultValue Description
bEnabled boolean true

New value for property enabled

setSelectionState

Sets a new value for property selectionState.

Defines the states of the checkbox

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

Default value is Unchecked.

Param Type DefaultValue Description
sSelectionState sap.ui.commons.TriStateCheckBoxState Unchecked

New value for property selectionState

setText

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.

Param Type DefaultValue Description
sText string

New value for property text

setTextDirection

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.

Param Type DefaultValue Description
sTextDirection sap.ui.core.TextDirection Inherit

New value for property textDirection

setValueState

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.

Param Type DefaultValue Description
sValueState sap.ui.core.ValueState None

New value for property valueState

setWidth

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.

Param Type DefaultValue Description
sWidth sap.ui.core.CSSSize

New value for property width

toggle

Method called whenever a user clicks on a tri-state checkbox

Param Type DefaultValue Description
destState sap.ui.commons.TriStateCheckBoxState

destined selection state of checkbox