class sap.ui.commons.RadioButtonGroup

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

The RadioButtonGroup is a basic control that is used to provide area for making interactive choice out of a set of options. It represents a list with items where exactly one item can be selected in a session. For the representation of the single group entries, the RadioButton items are created automatically. For the RadioButton choice, mouse and keyboard navigation usage is supported.


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.ui.commons.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


Properties

Name Type Default Value Description
columns int 1

Determines the maximum number of RadioButtons 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

Enables/disables the RadioButtonGroup. If it is disabled all RadioButtons will be displayed as disabled. The enabled property of the Item will not be used in this case. If the RadioButtonGroup is enabled, the enabled property of the Item will define if a RadioButton is enabled or not.

Since: 1.10.3.

Visibility: public
selectedIndex int 0

The index of the selected/checked RadioButton.

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

The value state to be displayed for the RadioButton. Possible values are: sap.ui.core.ValueState.Error, sap.ui.core.ValueState.Warning, sap.ui.core.ValueState.Success and sap.ui.core.ValueState.None. 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

Defines the width of the RadioButtonGroup.

Visibility: public

Aggregations

Default Aggregation: items

Name Cardinality Type Description
items (default) 0..n sap.ui.core.Item

The RadioButtons of this 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.

addItem

Adds some item to the aggregation items.

attachSelect

Attaches event handler fnFunction to the select event of this sap.ui.commons.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.ui.commons.RadioButtonGroup itself.

Fires when selection is changed by user interaction.

bindItems

Binds aggregation items 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.

destroyItems

Destroys all the items in the aggregation items.

detachSelect

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

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

sap.ui.commons.RadioButtonGroup.extend

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

getColumns

Gets current value of property columns.

Determines the maximum number of RadioButtons 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.

Enables/disables the RadioButtonGroup. If it is disabled all RadioButtons will be displayed as disabled. The enabled property of the Item will not be used in this case. If the RadioButtonGroup is enabled, the enabled property of the Item will define if a RadioButton is enabled or not.

Default value is true.

getItems

Gets content of aggregation items.

The RadioButtons of this RadioButtonGroup.

sap.ui.commons.RadioButtonGroup.getMetadata

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

getSelectedIndex

Gets current value of property selectedIndex.

The index of the selected/checked RadioButton.

Default value is 0.

getSelectedItem

When no item is selected, "null" is returned.

getValueState

Gets current value of property valueState.

The value state to be displayed for the RadioButton. Possible values are: sap.ui.core.ValueState.Error, sap.ui.core.ValueState.Warning, sap.ui.core.ValueState.Success and sap.ui.core.ValueState.None. 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.

Defines the width of the RadioButtonGroup.

indexOfItem

Checks for the provided sap.ui.core.Item in the aggregation items. and returns its index if found or -1 otherwise.

insertItem

Inserts a item into the aggregation items.

removeAllAriaDescribedBy

Removes all the controls in the association named ariaDescribedBy.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAllItems

Removes all the controls from the aggregation items.

Additionally, it unregisters them from the hosting UIArea.

removeAriaDescribedBy

Removes an ariaDescribedBy from the association named ariaDescribedBy.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

removeItem

Removes a item from the aggregation items.

setColumns

Sets a new value for property columns.

Determines the maximum number of RadioButtons 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 a new value for 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.

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.

Enables/disables the RadioButtonGroup. If it is disabled all RadioButtons will be displayed as disabled. The enabled property of the Item will not be used in this case. If the RadioButtonGroup is enabled, the enabled property of the Item will define if a RadioButton is enabled or not.

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

Default value is true.

setSelectedIndex

Sets a new value for property selectedIndex.

The index of the selected/checked RadioButton.

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

Default value is 0.

setSelectedItem

Sets the Item as selected and removes the selection from the previous one.

setValueState

Sets a new value for property valueState.

The value state to be displayed for the RadioButton. Possible values are: sap.ui.core.ValueState.Error, sap.ui.core.ValueState.Warning, sap.ui.core.ValueState.Success and sap.ui.core.ValueState.None. 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.

Defines the width of the RadioButtonGroup.

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

unbindItems

Unbinds aggregation items from model data.

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

addItem

Adds some item to the aggregation items.

Param Type DefaultValue Description
oItem sap.ui.core.Item

The item to add; if empty, nothing is inserted

attachSelect

Attaches event handler fnFunction to the select event of this sap.ui.commons.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.ui.commons.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.ui.commons.RadioButtonGroup itself

bindItems

Binds aggregation items 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.

destroyItems

Destroys all the items in the aggregation items.

detachSelect

Detaches event handler fnFunction from the select event of this sap.ui.commons.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

sap.ui.commons.RadioButtonGroup.extend

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

getColumns

Gets current value of property columns.

Determines the maximum number of RadioButtons 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.

Enables/disables the RadioButtonGroup. If it is disabled all RadioButtons will be displayed as disabled. The enabled property of the Item will not be used in this case. If the RadioButtonGroup is enabled, the enabled property of the Item will define if a RadioButton is enabled or not.

Default value is true.

getItems

Gets content of aggregation items.

The RadioButtons of this RadioButtonGroup.

sap.ui.commons.RadioButtonGroup.getMetadata

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

getSelectedIndex

Gets current value of property selectedIndex.

The index of the selected/checked RadioButton.

Default value is 0.

getSelectedItem

When no item is selected, "null" is returned.

getValueState

Gets current value of property valueState.

The value state to be displayed for the RadioButton. Possible values are: sap.ui.core.ValueState.Error, sap.ui.core.ValueState.Warning, sap.ui.core.ValueState.Success and sap.ui.core.ValueState.None. 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.

Defines the width of the RadioButtonGroup.

indexOfItem

Checks for the provided sap.ui.core.Item in the aggregation items. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oItem sap.ui.core.Item

The item whose index is looked for

insertItem

Inserts a item into the aggregation items.

Param Type DefaultValue Description
oItem sap.ui.core.Item

The item to insert; if empty, nothing is inserted

iIndex int

The 0-based index the item should be inserted at; for a negative value of iIndex, the item is inserted at position 0; for a value greater than the current size of the aggregation, the item is inserted at the last position

removeAllAriaDescribedBy

Removes all the controls in the association named ariaDescribedBy.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAllItems

Removes all the controls from the aggregation items.

Additionally, it unregisters them from the hosting UIArea.

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

removeItem

Removes a item from the aggregation items.

Param Type DefaultValue Description
vItem int string sap.ui.core.Item

The item to remove or its index or id

setColumns

Sets a new value for property columns.

Determines the maximum number of RadioButtons 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 a new value for 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.

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.

Enables/disables the RadioButtonGroup. If it is disabled all RadioButtons will be displayed as disabled. The enabled property of the Item will not be used in this case. If the RadioButtonGroup is enabled, the enabled property of the Item will define if a RadioButton is enabled or not.

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

setSelectedIndex

Sets a new value for property selectedIndex.

The index of the selected/checked RadioButton.

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

Default value is 0.

Param Type DefaultValue Description
iSelectedIndex int 0

New value for property selectedIndex

setSelectedItem

Sets the Item as selected and removes the selection from the previous one.

Param Type DefaultValue Description
oSelectedItem sap.ui.core.Item

Selected item

setValueState

Sets a new value for property valueState.

The value state to be displayed for the RadioButton. Possible values are: sap.ui.core.ValueState.Error, sap.ui.core.ValueState.Warning, sap.ui.core.ValueState.Success and sap.ui.core.ValueState.None. 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.

Defines 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

unbindItems

Unbinds aggregation items from model data.