Class sap.ui.commons.TriStateCheckBoxModule: sap/ui/commons/TriStateCheckBox

extends Control

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.
Deprecated API:
Since version 1.38.

Since: 1.7.2.
Constructor Summary
new sap.ui.commons.TriStateCheckBox(sId?, mSettings?)Constructor for a new TriStateCheckBox.
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.TriStateCheckBox.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.commons.TriStateCheckBox with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.commons.TriStateCheckBox.getMetadata()Returns a metadata object for class sap.ui.commons.TriStateCheckBox.
attachChange(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the change event of this sap.ui.commons.TriStateCheckBox.
detachChange(fnFunction, oListener)Detaches event handler fnFunction from the change event of this sap.ui.commons.TriStateCheckBox.
fireChange(mParameters?)Fires event change to attached listeners.
getEditable()Gets current value of property editable.
getEnabled()Gets current value of property enabled.
getSelectionState()Gets current value of property selectionState.
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.
setEditable(bEditable)Sets a new value for property editable.
setEnabled(bEnabled)Sets a new value for property enabled.
setSelectionState(sSelectionState)Sets a new value for property selectionState.
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(destState)Method called whenever a user clicks on a tri-state checkbox
Constructor Detail
new sap.ui.commons.TriStateCheckBox(sId?, mSettings?)

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 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:
stringsId?id for the new control, generated automatically if no id is given
objectmSettings?initial settings for the new 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.EventoControlEvent
sap.ui.base.EventProvideroControlEvent.getSource
objectoControlEvent.getParameters
stringoControlEvent.getParameters.selectionStateChecks whether the box is flagged or not flagged.
Method Detail
sap.ui.commons.TriStateCheckBox.extend(sClassName, oClassInfo?, FNMetaImpl?): function

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.

Parameters:
stringsClassNameName of the class being created
objectoClassInfo?Object literal with information about the class
functionFNMetaImpl?Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
functionCreated class / constructor function
sap.ui.commons.TriStateCheckBox.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.commons.TriStateCheckBox.
Returns:
sap.ui.base.MetadataMetadata object describing this class
attachChange(oData?, fnFunction, oListener?): sap.ui.commons.TriStateCheckBox

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.

Parameters:
objectoData?An application-specific payload object that will be passed to the event handler along with the event object when firing the event
functionfnFunctionThe function to be called when the event occurs
objectoListener?Context object to call the event handler with. Defaults to this sap.ui.commons.TriStateCheckBox itself
Returns:
sap.ui.commons.TriStateCheckBoxReference to this in order to allow method chaining
detachChange(fnFunction, oListener): sap.ui.commons.TriStateCheckBox

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.

Parameters:
functionfnFunctionThe function to be called, when the event occurs
objectoListenerContext object on which the given function had to be called
Returns:
sap.ui.commons.TriStateCheckBoxReference to this in order to allow method chaining
fireChange(mParameters?): sap.ui.commons.TriStateCheckBox
Fires event change to attached listeners.
Parameters:
objectmParameters?Parameters to pass along with the event
stringmParameters.selectionState?Checks whether the box is flagged or not flagged.
Returns:
sap.ui.commons.TriStateCheckBoxReference to this in order to allow method chaining
getEditable(): boolean

Gets current value of property editable.

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

Default value is true.

Returns:
booleanValue 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:
booleanValue of property enabled

Gets current value of property selectionState.

Defines the states of the checkbox

Default value is Unchecked.

Returns:
sap.ui.commons.TriStateCheckBoxStateValue of property selectionState
getText(): string

Gets current value of property text.

Defines the text displayed next to the check box

Returns:
stringValue 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.TextDirectionValue 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.ValueStateValue 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.CSSSizeValue of property width
setEditable(bEditable): sap.ui.commons.TriStateCheckBox

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.

Parameters:
booleanbEditableNew value for property editable
Returns:
sap.ui.commons.TriStateCheckBoxReference to this in order to allow method chaining
setEnabled(bEnabled): sap.ui.commons.TriStateCheckBox

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:
booleanbEnabledNew value for property enabled
Returns:
sap.ui.commons.TriStateCheckBoxReference to this in order to allow method chaining
setSelectionState(sSelectionState): sap.ui.commons.TriStateCheckBox

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.

Parameters:
sap.ui.commons.TriStateCheckBoxStatesSelectionStateNew value for property selectionState
Returns:
sap.ui.commons.TriStateCheckBoxReference to this in order to allow method chaining

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:
stringsTextNew value for property text
Returns:
sap.ui.commons.TriStateCheckBoxReference to this in order to allow method chaining
setTextDirection(sTextDirection): sap.ui.commons.TriStateCheckBox

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.TextDirectionsTextDirectionNew value for property textDirection
Returns:
sap.ui.commons.TriStateCheckBoxReference to this in order to allow method chaining
setValueState(sValueState): sap.ui.commons.TriStateCheckBox

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.ValueStatesValueStateNew value for property valueState
Returns:
sap.ui.commons.TriStateCheckBoxReference to this in order to allow method chaining

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.CSSSizesWidthNew value for property width
Returns:
sap.ui.commons.TriStateCheckBoxReference to this in order to allow method chaining
toggle(destState)
Method called whenever a user clicks on a tri-state checkbox
Parameters:
sap.ui.commons.TriStateCheckBoxStatedestStatedestined selection state of checkbox