Class sap.ui.commons.RadioButtonModule: sap/ui/commons/RadioButton

extends Control
implements IFormContent

RadioButton is a control similar to CheckBox, but it allows the user to choose only one of the predefined set of options.

Usually, RadioButton is used in a group with other RadioButtons (with the groupName property or by using sap.ui.commons.RadioButtonGroup), thus providing a limited choice for the user. An event is triggered when the user makes a change of the selection.

Deprecated API:
Since version 1.38. Instead, use the sap.m.RadioButton control.
Constructor Summary
new sap.ui.commons.RadioButton(sId?, mSettings?)Constructor for a new RadioButton.
Event Summary
select(oControlEvent)Triggers when the user makes a change on the RadioButton.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.ui.commons.RadioButton.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.commons.RadioButton with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.commons.RadioButton.getMetadata()Returns a metadata object for class sap.ui.commons.RadioButton.
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.ui.commons.RadioButton.
detachSelect(fnFunction, oListener)Detaches event handler fnFunction from the select event of this sap.ui.commons.RadioButton.
fireSelect(mParameters?)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.
getEditable()Gets current value of property editable.
getEnabled()Gets current value of property enabled.
getGroupName()Gets current value of property groupName.
getKey()Gets current value of property key.
getSelected()Gets current value of property selected.
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.
setEditable(bEditable)Sets a new value for property editable.
setEnabled(bEnabled)Sets a new value for property enabled.
setGroupName(sGroupName)Sets a new value for property groupName.
setKey(sKey)Sets a new value for property key.
setSelected(bSelected)Sets a new value for property selected.
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.
Constructor Detail
new sap.ui.commons.RadioButton(sId?, mSettings?)

Constructor for a new RadioButton.

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

  • Associations

  • 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:
stringsId?ID for the new control, generated automatically if no ID is given
objectmSettings?Initial settings for the new control
Event Detail
select(oControlEvent)
Triggers when the user makes a change on the RadioButton.
Parameters:
sap.ui.base.EventoControlEvent
sap.ui.base.EventProvideroControlEvent.getSource
objectoControlEvent.getParameters
Method Detail
sap.ui.commons.RadioButton.extend(sClassName, oClassInfo?, FNMetaImpl?): function

Creates a new subclass of class sap.ui.commons.RadioButton 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.RadioButton.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.commons.RadioButton.
Returns:
sap.ui.base.MetadataMetadata object describing this class
addAriaDescribedBy(vAriaDescribedBy): sap.ui.commons.RadioButton
Adds some ariaDescribedBy into the association ariaDescribedBy.
Parameters:
sap.ui.core.ID|sap.ui.core.ControlvAriaDescribedBythe ariaDescribedBy to add; if empty, nothing is inserted
Returns:
sap.ui.commons.RadioButtonReference to this in order to allow method chaining
addAriaLabelledBy(vAriaLabelledBy): sap.ui.commons.RadioButton
Adds some ariaLabelledBy into the association ariaLabelledBy.
Parameters:
sap.ui.core.ID|sap.ui.core.ControlvAriaLabelledBythe ariaLabelledBy to add; if empty, nothing is inserted
Returns:
sap.ui.commons.RadioButtonReference to this in order to allow method chaining
attachSelect(oData?, fnFunction, oListener?): sap.ui.commons.RadioButton

Attaches event handler fnFunction to the select event of this sap.ui.commons.RadioButton.

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

Triggers when the user makes a change on the RadioButton.

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.RadioButton itself
Returns:
sap.ui.commons.RadioButtonReference to this in order to allow method chaining
detachSelect(fnFunction, oListener): sap.ui.commons.RadioButton

Detaches event handler fnFunction from the select event of this sap.ui.commons.RadioButton.

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.RadioButtonReference to this in order to allow method chaining
fireSelect(mParameters?): sap.ui.commons.RadioButton
Fires event select to attached listeners.
Parameters:
objectmParameters?Parameters to pass along with the event
Returns:
sap.ui.commons.RadioButtonReference to this in order to allow method chaining
getAriaDescribedBy(): sap.ui.core.ID[]
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.
Returns:
sap.ui.core.ID[]
getAriaLabelledBy(): sap.ui.core.ID[]
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
Returns:
sap.ui.core.ID[]
getEditable(): boolean

Gets current value of property editable.

Specifies whether the user can select the RadioButton.

Default value is true.

Returns:
booleanValue of property editable
getEnabled(): boolean

Gets current value of property enabled.

Displays the disabled controls in another color, depending on the customer settings.

Default value is true.

Returns:
booleanValue of property enabled
getGroupName(): string

Gets current value of property groupName.

Defines the name of the RadioButtonGroup, in which the current RadioButton belongs to. You can define a new name for the group. If no new name is specified, the default is sapUiRbDefaultGroup. By default, when one of the RadioButtons in a group is selected, all others are unselected.

Default value is sapUiRbDefaultGroup.

Returns:
stringValue of property groupName
getKey(): string

Gets current value of property key.

Can be used for subsequent actions.

Returns:
stringValue of property key
getSelected(): boolean

Gets current value of property selected.

Specifies the select state of the RadioButton.

Default value is false.

Returns:
booleanValue of property selected
getText(): string

Gets current value of property text.

Defines the text displayed next to the RadioButton.

Returns:
stringValue of property text
getTextDirection(): sap.ui.core.TextDirection

Gets current value of property textDirection.

Defines the text direction - options are left-to-right (LTR) and right-to-left (RTL). Alternatively, the control can inherit the text direction from its parent container.

Default value is Inherit.

Returns:
sap.ui.core.TextDirectionValue of property textDirection
getValueState(): sap.ui.core.ValueState

Gets current value of property valueState.

Enumeration sap.ui.core.ValueState provides state values Error, Success, Warning and None.

Default value is None.

Returns:
sap.ui.core.ValueStateValue of property valueState
getWidth(): sap.ui.core.CSSSize

Gets current value of property width.

Determines the control width. By default, it depends on the text length. Alternatively, CSS sizes in % or px can be set.

Returns:
sap.ui.core.CSSSizeValue of property width
removeAllAriaDescribedBy(): sap.ui.core.ID[]
Removes all the controls in the association named ariaDescribedBy.
Returns:
sap.ui.core.ID[]An array of the removed elements (might be empty)
removeAllAriaLabelledBy(): sap.ui.core.ID[]
Removes all the controls in the association named ariaLabelledBy.
Returns:
sap.ui.core.ID[]An array of the removed elements (might be empty)
removeAriaDescribedBy(vAriaDescribedBy): sap.ui.core.ID
Removes an ariaDescribedBy from the association named ariaDescribedBy.
Parameters:
int|sap.ui.core.ID|sap.ui.core.ControlvAriaDescribedByThe ariaDescribedBy to be removed or its index or ID
Returns:
sap.ui.core.IDThe removed ariaDescribedBy or null
removeAriaLabelledBy(vAriaLabelledBy): sap.ui.core.ID
Removes an ariaLabelledBy from the association named ariaLabelledBy.
Parameters:
int|sap.ui.core.ID|sap.ui.core.ControlvAriaLabelledByThe ariaLabelledBy to be removed or its index or ID
Returns:
sap.ui.core.IDThe removed ariaLabelledBy or null
setEditable(bEditable): sap.ui.commons.RadioButton

Sets a new value for property editable.

Specifies whether the user can select the RadioButton.

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.RadioButtonReference to this in order to allow method chaining
setEnabled(bEnabled): sap.ui.commons.RadioButton

Sets a new value for property enabled.

Displays the disabled controls in another color, depending on the customer settings.

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.RadioButtonReference to this in order to allow method chaining
setGroupName(sGroupName): sap.ui.commons.RadioButton

Sets a new value for property groupName.

Defines the name of the RadioButtonGroup, in which the current RadioButton belongs to. You can define a new name for the group. If no new name is specified, the default is sapUiRbDefaultGroup. By default, when one of the RadioButtons in a group is selected, all others are unselected.

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

Default value is sapUiRbDefaultGroup.

Parameters:
stringsGroupNameNew value for property groupName
Returns:
sap.ui.commons.RadioButtonReference to this in order to allow method chaining

Sets a new value for property key.

Can be used for subsequent actions.

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

Parameters:
stringsKeyNew value for property key
Returns:
sap.ui.commons.RadioButtonReference to this in order to allow method chaining
setSelected(bSelected): sap.ui.commons.RadioButton

Sets a new value for property selected.

Specifies the select state of the RadioButton.

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

Default value is false.

Parameters:
booleanbSelectedNew value for property selected
Returns:
sap.ui.commons.RadioButtonReference to this in order to allow method chaining

Sets a new value for property text.

Defines the text displayed next to the RadioButton.

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.RadioButtonReference to this in order to allow method chaining
setTextDirection(sTextDirection): sap.ui.commons.RadioButton

Sets a new value for property textDirection.

Defines the text direction - options are left-to-right (LTR) and right-to-left (RTL). 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:
sap.ui.core.TextDirectionsTextDirectionNew value for property textDirection
Returns:
sap.ui.commons.RadioButtonReference to this in order to allow method chaining
setValueState(sValueState): sap.ui.commons.RadioButton

Sets a new value for property valueState.

Enumeration sap.ui.core.ValueState provides state values Error, Success, Warning and None.

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.RadioButtonReference to this in order to allow method chaining
setWidth(sWidth): sap.ui.commons.RadioButton

Sets a new value for property width.

Determines the control width. By default, it depends on the text length. Alternatively, CSS sizes in % or px can be set.

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.RadioButtonReference to this in order to allow method chaining