sap.m.Select.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.m.Select 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.Select.
Returns:
Adds some ariaLabelledBy into the association ariaLabelledBy
.
Parameters:
{string|sap.ui.core.Control} | vAriaLabelledBy | the ariaLabelledBy to add; if empty, nothing is inserted |
- Since:
- 1.27.0
Returns:
{sap.m.Select} | Reference to this in order to allow method chaining |
Adds an item to the aggregation named items
.
Parameters:
Returns:
Attaches event handler
fnFunction
to the
change
event of this
sap.m.Select
.
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.Select
itself.
This event is fired when the value in the selection field is changed in combination with one of the following actions:
- The focus leaves the selection field
- The Enter key is pressed
- The item is pressed
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.Select itself |
Returns:
{sap.m.Select} | Reference to this in order to allow method chaining |
Parameters:
{object} | oBindingInfo | The binding information |
Returns:
{sap.m.Select} | Reference to this in order to allow method chaining |
Closes the control's picker popup.
- Since:
- 1.16
Returns:
Creates a picker popup container where the selection should take place.
Parameters:
Returns:
Destroys all the items in the aggregation named items
.
Returns:
Detaches event handler
fnFunction
from the
change
event of this
sap.m.Select
.
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:
{sap.m.Select} | Reference to this in order to allow method chaining |
Fires event
change
to attached listeners.
Expects the following event parameters:
selectedItem
of type sap.ui.core.Item
The selected item.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
{sap.m.Select} | Reference to this in order to allow method chaining |
getAccessibilityInfo()
See:
{sap.ui.core.Control#getAccessibilityInfo} |
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy
.
- Since:
- 1.27.0
Returns:
getAutoAdjustWidth(): boolean
Gets current value of property
autoAdjustWidth
.
Indicates whether the width of the input field is determined by the selected item's content.
Default value is false
.
- Since:
- 1.16
Returns:
{boolean} | Value of property autoAdjustWidth |
getEnabled(): boolean
Gets current value of property
enabled
.
Indicates whether the user can change the selection.
Default value is true
.
Returns:
{boolean} | Value of property enabled |
Gets the enabled items from the aggregation named items
.
Parameters:
- Since:
- 1.22.0
Returns:
Gets the first item from the aggregation named items
.
- Since:
- 1.16
Returns:
getForceSelection(): boolean
Gets current value of property
forceSelection
.
Indicates whether the selection is restricted to one of the items in the list. Note: We strongly recommend that you always set this property to false
and bind the selectedKey
property to the desired value for better interoperability with data binding.
Default value is true
.
- Since:
- 1.34
Returns:
{boolean} | Value of property forceSelection |
Gets current value of property
icon
.
The URI to the icon that will be displayed only when using the IconOnly
type.
Default value is
.
- Since:
- 1.16
Returns:
Gets the item from the aggregation named items
at the given 0-based index.
Parameters:
{int} | iIndex | Index of the item to return. |
- Since:
- 1.16
Returns:
Gets the item with the given key from the aggregation named
items
.
Note: If duplicate keys exist, the first item matching the key is returned.
Parameters:
{string} | sKey | An item key that specifies the item to be retrieved. |
- Since:
- 1.16
Returns:
Gets aggregation
items
.
Note: This is the default aggregation.
Returns:
Gets the last item from the aggregation named items
.
- Since:
- 1.16
Returns:
Gets current value of property
maxWidth
.
Sets the maximum width of the control.
Note: This property is ignored if the autoAdjustWidth
property is set to true
.
Default value is 100%
.
Returns:
getName(): string
Gets current value of property
name
.
The name to be used in the HTML code (for example, for HTML forms that send data to the server via submit).
Default value is
.
Returns:
{string} | Value of property name |
Gets the selected item object from the aggregation named items
.
Returns:
{sap.ui.core.Item|null} | The current target of the selectedItem association, or null. |
getSelectedItemId(): string
Gets current value of property
selectedItemId
.
ID of the selected item.
Default value is
.
- Since:
- 1.12
Returns:
{string} | Value of property selectedItemId |
getSelectedKey(): string
Gets current value of property
selectedKey
.
Key of the selected item.
Note: If duplicate keys exist, the first item matching the key is used.
Default value is
.
- Since:
- 1.11
Returns:
{string} | Value of property selectedKey |
Gets current value of property
textAlign
.
Sets the horizontal alignment of the text within the input field.
Default value is Initial
.
- Since:
- 1.28
Returns:
Gets current value of property
textDirection
.
Specifies the direction of the text within the input field with enumerated options. By default, the control inherits text direction from the DOM.
Default value is Inherit
.
- Since:
- 1.28
Returns:
Gets current value of property
type
.
Type of a select. Possible values Default
, IconOnly
.
Default value is Default
.
- Since:
- 1.16
Returns:
Gets current value of property
width
.
Sets the width of the control. The default width is derived from the widest item. If the width defined is smaller than the widest item in the selection list, only the width of the selection field will be changed: the list will keep the width of its widest item. If the list is wider than the viewport, it is truncated and an ellipsis is displayed for each item. For phones, the width of the list is always the same as the viewport.
Note: This property is ignored if the autoAdjustWidth
property is set to true
.
Default value is auto
.
Returns:
indexOfItem(oItem): int
Checks for the provided sap.ui.core.Item
in the aggregation items
. and returns its index if found or -1 otherwise.
Parameters:
Returns:
{int} | The index of the provided control in the aggregation if found, or -1 otherwise |
Inserts an item into the aggregation named items
.
Parameters:
{sap.ui.core.Item} | oItem | The item to be inserted; 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. |
Returns:
isOpen(): boolean
Indicates whether the control's picker popup is opened.
- Since:
- 1.16
Returns:
{boolean} | Indicates whether the picker popup is currently open (this includes opening and closing animations). |
Open the control's picker popup.
- Since:
- 1.16
Returns:
Removes all the controls in the association named ariaLabelledBy
.
- Since:
- 1.27.0
Returns:
Removes all the items in the aggregation named items
. Additionally unregisters them from the hosting UIArea.
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 |
- Since:
- 1.27.0
Returns:
Removes an item from the aggregation named items
.
Parameters:
Returns:
Sets a new value for property
autoAdjustWidth
.
Indicates whether the width of the input field is determined by the selected item's content.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Parameters:
{boolean} | bAutoAdjustWidth | New value for property autoAdjustWidth |
- Since:
- 1.16
Returns:
{sap.m.Select} | Reference to this in order to allow method chaining |
Sets a new value for property
enabled
.
Indicates whether the user can change the selection.
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:
{sap.m.Select} | Reference to this in order to allow method chaining |
Sets a new value for property
forceSelection
.
Indicates whether the selection is restricted to one of the items in the list. Note: We strongly recommend that you always set this property to false
and bind the selectedKey
property to the desired value for better interoperability with data binding.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Parameters:
{boolean} | bForceSelection | New value for property forceSelection |
- Since:
- 1.34
Returns:
{sap.m.Select} | Reference to this in order to allow method chaining |
Sets a new value for property
icon
.
The URI to the icon that will be displayed only when using the IconOnly
type.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is
.
Parameters:
- Since:
- 1.16
Returns:
{sap.m.Select} | Reference to this in order to allow method chaining |
Sets a new value for property
maxWidth
.
Sets the maximum width of the control.
Note: This property is ignored if the autoAdjustWidth
property is set to true
.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is 100%
.
Parameters:
Returns:
{sap.m.Select} | Reference to this in order to allow method chaining |
Sets a new value for property
name
.
The name to be used in the HTML code (for example, for HTML forms that send data to the server via submit).
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is
.
Parameters:
{string} | sName | New value for property name |
Returns:
{sap.m.Select} | Reference to this in order to allow method chaining |
Sets the
selectedItem
association.
Default value is null
.
Parameters:
{string|sap.ui.core.Item|null} | vItem | New value for the selectedItem association. If an ID of a sap.ui.core.Item is given, the item with this ID becomes the selectedItem association. Alternatively, a sap.ui.core.Item instance may be given or null . If the value of null is provided, the first enabled item will be selected (if any items exist). |
Returns:
Sets the
selectedItemId
property.
Default value is an empty string ""
or undefined
.
Parameters:
{string|undefined} | vItem | New value for property selectedItemId . If the provided vItem has a default value, the first enabled item will be selected (if any items exist). |
- Since:
- 1.12
Returns:
Sets property
selectedKey
.
Default value is an empty string ""
or undefined
.
Parameters:
{string} | sKey | New value for property selectedKey . If the forceSelection property is set to true and the provided sKey is an empty string "" or undefined , the value of sKey is changed to match the key of the first enabled item and the first enabled item is selected (if any items exist). In the case that an item has the default key value, it is selected instead. If duplicate keys exist, the first item matching the key is selected. |
- Since:
- 1.11
Returns:
Sets a new value for property
textAlign
.
Sets the horizontal alignment of the text within the input field.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Initial
.
Parameters:
- Since:
- 1.28
Returns:
{sap.m.Select} | Reference to this in order to allow method chaining |
Sets a new value for property
textDirection
.
Specifies the direction of the text within the input field 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
.
Parameters:
- Since:
- 1.28
Returns:
{sap.m.Select} | Reference to this in order to allow method chaining |
Sets a new value for property
type
.
Type of a select. Possible values Default
, IconOnly
.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Default
.
Parameters:
- Since:
- 1.16
Returns:
{sap.m.Select} | Reference to this in order to allow method chaining |
Sets a new value for property
width
.
Sets the width of the control. The default width is derived from the widest item. If the width defined is smaller than the widest item in the selection list, only the width of the selection field will be changed: the list will keep the width of its widest item. If the list is wider than the viewport, it is truncated and an ellipsis is displayed for each item. For phones, the width of the list is always the same as the viewport.
Note: This property is ignored if the autoAdjustWidth
property is set to true
.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is auto
.
Parameters:
Returns:
{sap.m.Select} | Reference to this in order to allow method chaining |
Unbinds aggregation items
from model data.
Returns:
{sap.m.Select} | Reference to this in order to allow method chaining |