class sap.m.RadioButtonGroup

Control sample: sap.m.RadioButtonGroup
Visiblity: public
UX Guidelines:
Implements: sap.ui.core.IFormContent
Available since: N/A
Module: sap/m/RadioButtonGroup
Application Component: CA-UI5-CTR

This control is used as a wrapper for a group of sap.m.RadioButton controls, which can be used as a single UI element. You can select only one of the grouped radio buttons at a time.

Structure

Usage

When to use:

When not to use:


Constructor

Constructor for a new RadioButtonGroup.

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.m.RadioButtonGroup(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 A wrapper control for a group of radio buttons.


Properties

Name Type Default Value Description
columns int 1

Specifies the maximum number of radio buttons displayed in one line.

Visibility: public
editable boolean true

Specifies whether the user can change the selected value of the RadioButtonGroup. When the property is set to false, the control obtains visual styles different from its visual styles for the normal and the disabled state. Additionally, the control is no longer interactive, but can receive focus.

Visibility: public
enabled boolean true

Switches the enabled state of the control. All radio buttons inside a disabled group are disabled.

Visibility: public
selectedIndex int 0

Determines the index of the selected/checked RadioButton. Default is 0. If no radio button is selected, the selectedIndex property will return -1.

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

This property specifies the element's text directionality with enumerated options. By default, the control inherits text direction from the DOM.

Since: 1.28.0.

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

Marker for the correctness of the current value e.g., Error, Success, etc. Changing this property will also change the state of all radio buttons inside the group. Note: Setting this attribute to sap.ui.core.ValueState.Error when the accessibility feature is enabled, sets the value of the invalid property for the whole RadioButtonGroup to "true".

Visibility: public
width sap.ui.core.CSSSize

Specifies the width of the RadioButtonGroup.

Visibility: public

Aggregations

Default Aggregation: buttons

Name Cardinality Type Description
buttons (default) 0..n sap.m.RadioButton

Returns a list of the RadioButtons in a RadioButtonGroup


Associations

Name Cardinality Type Description
ariaDescribedBy 0..n sap.ui.core.Control

Association to controls / IDs which describe this control (see WAI-ARIA attribute aria-describedby).

ariaLabelledBy 0..n sap.ui.core.Control

Association to controls / IDs which label this control (see WAI-ARIA attribute aria-labelledby).


Events Overview

Event Description
select

Fires when selection is changed by user interaction.

select

Fires when selection is changed by user interaction.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
selectedIndex int

Index of the selected RadioButton.


Methods Overview

Method Description
addAriaDescribedBy

Adds some ariaDescribedBy into the association ariaDescribedBy.

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

addButton

Adds a new radio button to the group.

attachSelect

Attaches event handler fnFunction to the select event of this sap.m.RadioButtonGroup.

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

Fires when selection is changed by user interaction.

bindButtons

Binds aggregation buttons to model data.

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

clone

Creates a new instance of RadioButtonGroup, with the same settings as the RadioButtonGroup on which the method is called. Event handlers are not cloned.

destroyButtons

Destroys all radio buttons.

detachSelect

Detaches event handler fnFunction from the select event of this sap.m.RadioButtonGroup.

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

exit

Exits the radio button group.

sap.m.RadioButtonGroup.extend

Creates a new subclass of class sap.m.RadioButtonGroup 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.

fireSelect

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.

getButtons

Gets content of aggregation buttons.

Returns a list of the RadioButtons in a RadioButtonGroup

getColumns

Gets current value of property columns.

Specifies the maximum number of radio buttons displayed in one line.

Default value is 1.

getEditable

Gets current value of property editable.

Specifies whether the user can change the selected value of the RadioButtonGroup. When the property is set to false, the control obtains visual styles different from its visual styles for the normal and the disabled state. Additionally, the control is no longer interactive, but can receive focus.

Default value is true.

getEnabled

Gets current value of property enabled.

Switches the enabled state of the control. All radio buttons inside a disabled group are disabled.

Default value is true.

sap.m.RadioButtonGroup.getMetadata

Returns a metadata object for class sap.m.RadioButtonGroup.

getSelectedButton

Returns the selected radio button.

getSelectedIndex

Gets current value of property selectedIndex.

Determines the index of the selected/checked RadioButton. Default is 0. If no radio button is selected, the selectedIndex property will return -1.

Default value is 0.

getTextDirection

Gets current value of property textDirection.

This property specifies the element's text directionality with enumerated options. By default, the control inherits text direction from the DOM.

Default value is Inherit.

getValueState

Gets current value of property valueState.

Marker for the correctness of the current value e.g., Error, Success, etc. Changing this property will also change the state of all radio buttons inside the group. Note: Setting this attribute to sap.ui.core.ValueState.Error when the accessibility feature is enabled, sets the value of the invalid property for the whole RadioButtonGroup to "true".

Default value is None.

getWidth

Gets current value of property width.

Specifies the width of the RadioButtonGroup.

indexOfButton

Checks for the provided sap.m.RadioButton in the aggregation buttons. and returns its index if found or -1 otherwise.

insertButton

Adds a new radio button to the group at a specified index.

onAfterRendering

Overwrites the onAfterRendering

onBeforeRendering

Overwrites the onBeforeRendering method.

removeAllAriaDescribedBy

Removes all the controls in the association named ariaDescribedBy.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAllButtons

Removes all radio buttons.

removeAriaDescribedBy

Removes an ariaDescribedBy from the association named ariaDescribedBy.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

removeButton

Removes a radio button from the group.

setColumns

Sets a new value for property columns.

Specifies the maximum number of radio buttons displayed in one line.

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

Default value is 1.

setEditable

Sets the editable property of the RadioButtonGroup. Single buttons preserve the value of their editable property. If the group is set to editable=false the buttons are also displayed and function as read only. Non editable radio buttons can still obtain focus.

setEnabled

Sets the enabled property of the RadioButtonGroup. Single buttons preserve internally the value of their enabled property. If the group is set to enabled=false the buttons are also displayed as disabled and getEnabled returns false.

setSelectedButton

Sets the selected sap.m.RadioButton using sap.m.RadioButton.

setSelectedIndex

Sets the selected sap.m.RadioButton using index.

setTextDirection

Sets a new value for property textDirection.

This property specifies the element's text directionality with enumerated options. By default, the control inherits text direction from the DOM.

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.

Marker for the correctness of the current value e.g., Error, Success, etc. Changing this property will also change the state of all radio buttons inside the group. Note: Setting this attribute to sap.ui.core.ValueState.Error when the accessibility feature is enabled, sets the value of the invalid property for the whole RadioButtonGroup to "true".

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.

Specifies the width of the RadioButtonGroup.

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

unbindButtons

Unbinds aggregation buttons from model data.

updateButtons

Updates the buttons in the group.

addAriaDescribedBy

Adds some ariaDescribedBy into the association ariaDescribedBy.

Param Type DefaultValue Description
vAriaDescribedBy sap.ui.core.ID sap.ui.core.Control

The ariaDescribedBy to add; if empty, nothing is inserted

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to add; if empty, nothing is inserted

addButton

Adds a new radio button to the group.

Param Type DefaultValue Description
oButton sap.m.RadioButton

The button which will be added to the group.

attachSelect

Attaches event handler fnFunction to the select event of this sap.m.RadioButtonGroup.

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

Fires when selection is changed by user interaction.

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.m.RadioButtonGroup itself

bindButtons

Binds aggregation buttons to model data.

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

Param Type DefaultValue Description
oBindingInfo sap.ui.base.ManagedObject.AggregationBindingInfo

The binding information

clone

Creates a new instance of RadioButtonGroup, with the same settings as the RadioButtonGroup on which the method is called. Event handlers are not cloned.

destroyButtons

Destroys all radio buttons.

detachSelect

Detaches event handler fnFunction from the select event of this sap.m.RadioButtonGroup.

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

exit

Exits the radio button group.

sap.m.RadioButtonGroup.extend

Creates a new subclass of class sap.m.RadioButtonGroup 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

fireSelect

Fires event select to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

selectedIndex int

Index of the selected RadioButton.

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.

getButtons

Gets content of aggregation buttons.

Returns a list of the RadioButtons in a RadioButtonGroup

getColumns

Gets current value of property columns.

Specifies the maximum number of radio buttons displayed in one line.

Default value is 1.

getEditable

Gets current value of property editable.

Specifies whether the user can change the selected value of the RadioButtonGroup. When the property is set to false, the control obtains visual styles different from its visual styles for the normal and the disabled state. Additionally, the control is no longer interactive, but can receive focus.

Default value is true.

getEnabled

Gets current value of property enabled.

Switches the enabled state of the control. All radio buttons inside a disabled group are disabled.

Default value is true.

sap.m.RadioButtonGroup.getMetadata

Returns a metadata object for class sap.m.RadioButtonGroup.

getSelectedButton

Returns the selected radio button.

getSelectedIndex

Gets current value of property selectedIndex.

Determines the index of the selected/checked RadioButton. Default is 0. If no radio button is selected, the selectedIndex property will return -1.

Default value is 0.

getTextDirection

Gets current value of property textDirection.

This property specifies the element's text directionality with enumerated options. By default, the control inherits text direction from the DOM.

Default value is Inherit.

getValueState

Gets current value of property valueState.

Marker for the correctness of the current value e.g., Error, Success, etc. Changing this property will also change the state of all radio buttons inside the group. Note: Setting this attribute to sap.ui.core.ValueState.Error when the accessibility feature is enabled, sets the value of the invalid property for the whole RadioButtonGroup to "true".

Default value is None.

getWidth

Gets current value of property width.

Specifies the width of the RadioButtonGroup.

indexOfButton

Checks for the provided sap.m.RadioButton in the aggregation buttons. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oButton sap.m.RadioButton

The button whose index is looked for

insertButton

Adds a new radio button to the group at a specified index.

Param Type DefaultValue Description
oButton sap.m.RadioButton

The radio button which will be added to the group.

iIndex number

The index, at which the radio button will be added.

onAfterRendering

Overwrites the onAfterRendering

onBeforeRendering

Overwrites the onBeforeRendering method.

removeAllAriaDescribedBy

Removes all the controls in the association named ariaDescribedBy.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAllButtons

Removes all radio buttons.

removeAriaDescribedBy

Removes an ariaDescribedBy from the association named ariaDescribedBy.

Param Type DefaultValue Description
vAriaDescribedBy int sap.ui.core.ID sap.ui.core.Control

The ariaDescribedBy to be removed or its index or ID

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy int sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to be removed or its index or ID

removeButton

Removes a radio button from the group.

setColumns

Sets a new value for property columns.

Specifies the maximum number of radio buttons displayed in one line.

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

Default value is 1.

Param Type DefaultValue Description
iColumns int 1

New value for property columns

setEditable

Sets the editable property of the RadioButtonGroup. Single buttons preserve the value of their editable property. If the group is set to editable=false the buttons are also displayed and function as read only. Non editable radio buttons can still obtain focus.

Param Type DefaultValue Description
bEditable boolean

Defines whether the radio buttons should be interactive.

setEnabled

Sets the enabled property of the RadioButtonGroup. Single buttons preserve internally the value of their enabled property. If the group is set to enabled=false the buttons are also displayed as disabled and getEnabled returns false.

Param Type DefaultValue Description
bEnabled boolean

Defines whether the radio buttons should be interactive.

setSelectedButton

Sets the selected sap.m.RadioButton using sap.m.RadioButton.

Param Type DefaultValue Description
oSelectedButton sap.m.RadioButton

The item to be selected.

setSelectedIndex

Sets the selected sap.m.RadioButton using index.

Param Type DefaultValue Description
iSelectedIndex number

The index of the radio button which has to be selected.

setTextDirection

Sets a new value for property textDirection.

This property specifies the element's text directionality with enumerated options. By default, the control inherits text direction from the DOM.

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.

Marker for the correctness of the current value e.g., Error, Success, etc. Changing this property will also change the state of all radio buttons inside the group. Note: Setting this attribute to sap.ui.core.ValueState.Error when the accessibility feature is enabled, sets the value of the invalid property for the whole RadioButtonGroup to "true".

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.

Specifies the width of the RadioButtonGroup.

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

unbindButtons

Unbinds aggregation buttons from model data.

updateButtons

Updates the buttons in the group.