The SegmentedButton provides a group of multiple buttons. Only one button can be active. The behaviour is more ore less like a radio button group.
Constructor for a new SegmentedButton.
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.SegmentedButton(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 |
Default Aggregation:
Name | Cardinality | Type | Description |
---|---|---|---|
buttons | 0..n | sap.ui.commons.Button |
Buttons |
Name | Cardinality | Type | Description |
---|---|---|---|
selectedButton | 0..1 | sap.ui.commons.Button |
Selected Button |
Method | Description |
---|---|
_rerenderButtons |
Rerendering of the Buttons |
addButton |
Adds some button to the aggregation buttons. |
attachSelect |
Attaches event handler When called, the context of the event handler (its Event fired when button selected |
destroyButtons |
Destroys all the buttons in the aggregation buttons. |
detachSelect |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
sap.ui.commons.SegmentedButton.extend |
Creates a new subclass of class sap.ui.commons.SegmentedButton with name
|
fireSelect |
Fires event select to attached listeners. |
getButtons |
Gets content of aggregation buttons. Buttons |
getEnabled |
Gets current value of property enabled. enabled Default value is |
sap.ui.commons.SegmentedButton.getMetadata |
Returns a metadata object for class sap.ui.commons.SegmentedButton. |
getSelectedButton |
ID of the element which is the current target of the association selectedButton, or |
indexOfButton |
Checks for the provided |
insertButton |
Inserts a button into the aggregation buttons. |
removeAllButtons |
Removes all the controls from the aggregation buttons. Additionally, it unregisters them from the hosting UIArea. |
removeButton |
Removes a button from the aggregation buttons. |
setEnabled |
Sets a new value for property enabled. enabled When called with a value of Default value is |
setSelectedButton |
Sets the associated selectedButton. |
Adds some button to the aggregation buttons.
Param | Type | DefaultValue | Description |
---|---|---|---|
oButton | sap.ui.commons.Button |
The button to add; if empty, nothing is inserted |
Attaches event handler fnFunction
to the select event of this sap.ui.commons.SegmentedButton
.
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.SegmentedButton
itself.
Event fired when button selected
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 |
Detaches event handler fnFunction
from the select event of this sap.ui.commons.SegmentedButton
.
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 |
Creates a new subclass of class sap.ui.commons.SegmentedButton 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 |
Fires event select to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
selectedButtonId | string |
Id of selected ToggleButton |
Returns a metadata object for class sap.ui.commons.SegmentedButton.
ID of the element which is the current target of the association selectedButton, or null
.
Checks for the provided sap.ui.commons.Button
in the aggregation buttons. and returns its index if found or -1 otherwise.
Param | Type | DefaultValue | Description |
---|---|---|---|
oButton | sap.ui.commons.Button |
The button whose index is looked for |
Inserts a button into the aggregation buttons.
Param | Type | DefaultValue | Description |
---|---|---|---|
oButton | sap.ui.commons.Button |
The button to insert; if empty, nothing is inserted |
|
iIndex | int |
The |
Removes all the controls from the aggregation buttons.
Additionally, it unregisters them from the hosting UIArea.
Removes a button from the aggregation buttons.
Param | Type | DefaultValue | Description |
---|---|---|---|
vButton | int string sap.ui.commons.Button |
The button to remove or its index or id |
Sets a new value for property enabled.
enabled
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 |
Sets the associated selectedButton.
Param | Type | DefaultValue | Description |
---|---|---|---|
oSelectedButton | sap.ui.core.ID sap.ui.commons.Button |
ID of an element which becomes the new target of this selectedButton association; alternatively, an element instance may be given |