sap.m.SegmentedButton.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.m.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.
Parameters:
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
Returns:
{function} | Created class / constructor function |
Returns a metadata object for class sap.m.SegmentedButton.
Returns:
Adds some ariaDescribedBy into the association ariaDescribedBy
.
Parameters:
{string|sap.ui.core.Control} | vAriaDescribedBy | the ariaDescribedBy to add; if empty, nothing is inserted |
Returns:
Adds some ariaLabelledBy into the association ariaLabelledBy
.
Parameters:
{string|sap.ui.core.Control} | vAriaLabelledBy | the ariaLabelledBy to add; if empty, nothing is inserted |
Returns:
Adds some item to the aggregation items
.
Parameters:
- Since:
- 1.28
Returns:
Attaches event handler
fnFunction
to the
select
event of this
sap.m.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.m.SegmentedButton
itself.
Fires when the user selects a button, which returns the ID and button object.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.m.SegmentedButton itself |
Returns:
Parameters:
{object} | oBindingInfo | The binding information |
- Since:
- 1.28
Returns:
Binds property
selectedKey
to model data.
See ManagedObject.bindProperty for a detailed description of the possible properties of oBindingInfo
Parameters:
{object} | oBindingInfo | The binding information |
- Since:
- 1.28.0
Returns:
createButton
(sText, sURI, bEnabled, sTextDirection?): sap.m.Button Adds a Button with a text as title, an URI for an icon, enabled and textDirection. Only one is allowed.
Parameters:
{string} | sText | Defines the title text of the newly created Button |
{sap.ui.core.URI} | sURI | Icon to be displayed as graphical element within the Button. Density related image will be loaded if image with density awareness name in format [imageName]@[densityValue].[extension] is provided. |
{boolean} | bEnabled | Enables the control (default is true). Buttons that are disabled have other colors than enabled ones, depending on custom settings. |
{sap.ui.core.TextDirection} | sTextDirection? | Element's text directionality with enumerated options |
- Since:
- 1.28.0
Returns:
Destroys all the items in the aggregation items
.
- Since:
- 1.28
Returns:
Detaches event handler
fnFunction
from the
select
event of this
sap.m.SegmentedButton
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Fires event
select
to attached listeners.
Expects the following event parameters:
button
of type sap.m.Button
Reference to the button, that has been selected.id
of type string
ID of the button, which has been selected.key
of type string
Key of the button, which has been selected. This property is only filled when the control is initiated with the items aggregation.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy
.
Returns:
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy
.
Returns:
getEnabled(): boolean
Gets current value of property
enabled
.
Disables all the buttons in the SegmentedButton control. When disabled all the buttons look grey and you cannot focus or click on them.
Default value is true
.
Returns:
{boolean} | Value of property enabled |
Gets content of aggregation
items
.
Aggregation of items to be displayed. The items set in this aggregation are used as an interface for the buttons displayed by the control. The "items" and "buttons" aggregations should NOT be used simultaneously as it causes the control to work incorrectly.
- Since:
- 1.28
Returns:
ID of the element which is the current target of the association selectedButton
, or null
.
Returns:
Gets current value of property
width
.
Defines the width of the SegmentedButton control. If not set, it uses the minimum required width to make all buttons inside of the same size (based on the biggest button).
Returns:
indexOfItem(oItem): int
Checks for the provided sap.m.SegmentedButtonItem
in the aggregation items
. and returns its index if found or -1 otherwise.
Parameters:
- Since:
- 1.28
Returns:
{int} | The index of the provided control in the aggregation if found, or -1 otherwise |
Inserts a item into the aggregation items
.
Parameters:
{sap.m.SegmentedButtonItem} | oItem | the item to insert; if empty, nothing is inserted |
{int} | iIndex | 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 |
- Since:
- 1.28
Returns:
Removes all the controls in the association named ariaDescribedBy
.
Returns:
Removes all the controls in the association named ariaLabelledBy
.
Returns:
Removes all the controls from the aggregation
items
.
Additionally, it unregisters them from the hosting UIArea.
- Since:
- 1.28
Returns:
Removes an ariaDescribedBy from the association named ariaDescribedBy
.
Parameters:
{int|string|sap.ui.core.Control} | vAriaDescribedBy | The ariaDescribedByto be removed or its index or ID |
Returns:
Removes an ariaLabelledBy from the association named ariaLabelledBy
.
Parameters:
{int|string|sap.ui.core.Control} | vAriaLabelledBy | The ariaLabelledByto be removed or its index or ID |
Returns:
Removes a item from the aggregation items
.
Parameters:
- Since:
- 1.28
Returns:
Sets a new value for property
enabled
.
Disables all the buttons in the SegmentedButton control. When disabled all the buttons look grey and you cannot focus or click on them.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Parameters:
{boolean} | bEnabled | New value for property enabled |
Returns:
Setter for association selectedButton
.
Parameters:
{string|sap.m.Button|null|undefined} | vButton | New value for association setSelectedButton A sap.m.Button instance which becomes the new target of this selectedButton association. Alternatively, the ID of a sap.m.Button instance may be given as a string. If the value of null, undefined, or an empty string is provided the first item will be selected. |
Returns:
Sets a new value for property
width
.
Defines the width of the SegmentedButton control. If not set, it uses the minimum required width to make all buttons inside of the same size (based on the biggest button).
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
Returns:
Unbinds aggregation items
from model data.
- Since:
- 1.28
Returns:
Unbinds property selectedKey
from model data.
- Since:
- 1.28.0
Returns:
Adds some button to the aggregation buttons
.
Parameters:
{sap.m.Button} | oButton | the button to add; if empty, nothing is inserted |
- Deprecated:
- Since 1.28.0 Instead use the "items" aggregation.
Returns:
Destroys all the buttons in the aggregation buttons
.
- Deprecated:
- Since 1.28.0 Instead use the "items" aggregation.
Returns:
Gets content of aggregation
buttons
.
The buttons of the SegmentedButton control. The items set in this aggregation are used as an interface for the buttons displayed by the control. Only the properties ID, icon, text, enabled and textDirections of the Button control are evaluated. Setting other properties of the button will have no effect. Alternatively, you can use the createButton method to add buttons.
- Deprecated:
- Since 1.28.0 Instead use the "items" aggregation.
Returns:
indexOfButton(oButton): int
Checks for the provided sap.m.Button
in the aggregation buttons
. and returns its index if found or -1 otherwise.
Parameters:
- Deprecated:
- Since 1.28.0 Instead use the "items" aggregation.
Returns:
{int} | The index of the provided control in the aggregation if found, or -1 otherwise |
Inserts a button into the aggregation buttons
.
Parameters:
{sap.m.Button} | oButton | the button to insert; if empty, nothing is inserted |
{int} | iIndex | the 0 -based index the button should be inserted at; for a negative value of iIndex , the button is inserted at position 0; for a value greater than the current size of the aggregation, the button is inserted at the last position |
- Deprecated:
- Since 1.28.0 Instead use the "items" aggregation.
Returns:
Removes all the controls from the aggregation
buttons
.
Additionally, it unregisters them from the hosting UIArea.
- Deprecated:
- Since 1.28.0 Instead use the "items" aggregation.
Returns:
{sap.m.Button[]} | An array of the removed elements (might be empty) |
Removes a button from the aggregation buttons
.
Parameters:
{int|string|sap.m.Button} | vButton | The buttonto remove or its index or id |
- Deprecated:
- Since 1.28.0 Instead use the "items" aggregation.
Returns: