class sap.m.Select

Control sample: sap.m.Select
Visiblity: public
UX Guidelines: Select
Implements: sap.ui.core.IFormContentsap.ui.core.ISemanticFormContentsap.m.IOverflowToolbarContentsap.f.IShellBar
Available since: N/A
Module: sap/m/Select
Application Component: CA-UI5-CTR

The sap.m.Select control provides a list of items that allows users to select an item.


Constructor

Constructor for a new sap.m.Select.

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.Select(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
autoAdjustWidth boolean false

Indicates whether the width of the input field is determined by the selected item's content.

Since: 1.16.

Visibility: public
columnRatio sap.m.SelectColumnRatio 3:2

Determines the ratio between the first and the second column when secondary values are displayed.

Note: This property takes effect only when the showSecondaryValues property is set to true.

Since: 1.86.

Visibility: public
editable boolean true

Determines whether the user can modify the selected item. When the property is set to false, the control appears as disabled but CAN still be focused.

Note: When both enabled and editable properties are set to false, enabled has priority over editable.

Since: 1.66.0.

Visibility: public
enabled boolean true

Determines whether the user can modify the selected item. When the property is set to false, the control appears as disabled and CANNOT be focused.

Note: When both enabled and editable properties are set to false, enabled has priority over editable.

Visibility: public
forceSelection boolean true

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.

Since: 1.34.

Visibility: public
icon sap.ui.core.URI empty string

The URI to the icon that will be displayed only when using the IconOnly type.

Since: 1.16.

Visibility: public
maxWidth sap.ui.core.CSSSize 100%

Sets the maximum width of the control.

Note: This property is ignored if the autoAdjustWidth property is set to true.

Visibility: public
name string empty string

The name to be used in the HTML code (for example, for HTML forms that send data to the server via submit).

Visibility: public
required boolean false

Indicates that user input is required. This property is only needed for accessibility purposes when a single relationship between the field and a label (see aggregation labelFor of sap.m.Label) cannot be established (e.g. one label should label multiple fields).

Since: 1.74.

Visibility: public
resetOnMissingKey boolean false

Modifies the behavior of the setSelectedKey method so that the selected item is cleared when a provided selected key is missing.

Since: 1.77.

Visibility: public
selectedItemId string empty string

ID of the selected item.

Since: 1.12.

Visibility: public
selectedKey string empty string

Key of the selected item.

Notes:

  • If duplicate keys exist, the first item matching the key is used.
  • If invalid or none selectedKey is used, the first item is being selected.
  • Invalid or missing selectedKey leads to severe functional issues in sap.ui.table.Table, when the sap.m.Select is used inside a sap.ui.table.Table column.


Since: 1.11.

Visibility: public
showSecondaryValues boolean false

Indicates whether the text values of the additionalText property of a sap.ui.core.ListItem are shown.

Since: 1.40.

Visibility: public
textAlign sap.ui.core.TextAlign Initial

Sets the horizontal alignment of the text within the input field.

Since: 1.28.

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

Specifies the direction of the text within the input field with enumerated options. By default, the control inherits text direction from the DOM.

Since: 1.28.

Visibility: public
type sap.m.SelectType Default

Type of a select. Possible values Default, IconOnly.

Since: 1.16.

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

Visualizes the validation state of the control, e.g. Error, Warning, Success, Information.

Since: 1.40.2.

Visibility: public
valueStateText string empty string

Defines the text of the value state message popup. If this is not specified, a default text is shown from the resource bundle.

Since: 1.40.5.

Visibility: public
width sap.ui.core.CSSSize auto

Sets the width of the field. By default, the field width is automatically adjusted to the size of its content and the default width of the field is calculated based on the widest list item in the dropdown list. If the width defined is smaller than its content, only the field width is changed whereas the dropdown list keeps the width of its content. If the dropdown list is wider than the visual viewport, it is truncated and an ellipsis is displayed for each item. For phones, the width of the dropdown list is always the same as the viewport.

Note: This property is ignored if the autoAdjustWidth property is set to true.

Visibility: public
wrapItemsText boolean false

Determines whether the text in the items wraps on multiple lines when the available width is not enough. When the text is truncated (wrapItemsText property is set to false), the max width of the SelectList is 600px. When wrapItemsText is set to true, SelectList takes all of the available width.

Since: 1.69.

Visibility: public

Aggregations

Default Aggregation: items

Name Cardinality Type Description
_pickerHeader 0..1 sap.m.Bar

Internal aggregation to hold the picker's header

Since: 1.52.

_pickerValueStateContent 0..1 sap.m.Text

Internal aggregation to hold the picker's subheader.

_valueIcon 0..1 sap.ui.core.Icon

Icon, displayed in the left most area of the Select input.

items (default) 0..n sap.ui.core.Item

Defines the items contained within this control.

Note: For items with icons you can use sap.ui.core.ListItem.

Example:

 <ListItem text="Paper plane" icon="sap-icon://paper-plane"></ListItem> 

picker 0..1 sap.ui.core.PopupInterface

Internal aggregation to hold the inner picker popup.


Associations

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

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

Since: 1.27.0.

selectedItem 0..1 sap.ui.core.Item

Sets or retrieves the selected item from the aggregation named items.


Events Overview

Event Description
change

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

change

This event is fired when the value in the selection field is changed in combination with one of the following actions:

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
selectedItem sap.ui.core.Item

The selected item.

previousSelectedItem sap.ui.core.Item

The previous selected item.

Since: 1.95.


Methods Overview

Method Description
addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

addItem

Adds an item to the aggregation named items.

attachChange

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

bindItems

Binds aggregation items to model data.

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

close

Closes the control's picker popup.

createPicker

Creates a picker popup container where the selection should take place.

destroyItems

Destroys all the items in the aggregation named items.

detachChange

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.

sap.m.Select.extend

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.

fireChange

Fires event change to attached listeners.

getAccessibilityInfo

Returns the sap.m.Select accessibility information.

References:

  • sap.ui.core.Control#getAccessibilityInfo

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getAutoAdjustWidth

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.

getColumnRatio

Gets current value of property columnRatio.

Determines the ratio between the first and the second column when secondary values are displayed.

Note: This property takes effect only when the showSecondaryValues property is set to true.

Default value is "3:2".

getEditable

Gets current value of property editable.

Determines whether the user can modify the selected item. When the property is set to false, the control appears as disabled but CAN still be focused.

Note: When both enabled and editable properties are set to false, enabled has priority over editable.

Default value is true.

getEnabled

Gets current value of property enabled.

Determines whether the user can modify the selected item. When the property is set to false, the control appears as disabled and CANNOT be focused.

Note: When both enabled and editable properties are set to false, enabled has priority over editable.

Default value is true.

getEnabledItems

Gets the enabled items from the aggregation named items.

getFirstItem

Gets the first item from the aggregation named items.

getFocusDomRef

Returns the DOM Element that should get the focus.

getForceSelection

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.

getIcon

Gets current value of property icon.

The URI to the icon that will be displayed only when using the IconOnly type.

Default value is empty string.

getIdForLabel

Returns the DOMNode Id to be used for the "labelFor" attribute of the label.

By default, this is the Id of the control itself.

getItemAt

Gets the item from the aggregation named items at the given 0-based index.

getItemByKey

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.

getItems

Gets aggregation items.

Note: This is the default aggregation.

getLastItem

Gets the last item from the aggregation named items.

getMaxWidth

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%".

sap.m.Select.getMetadata

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

getName

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 empty string.

getOverflowToolbarConfig

Enables the sap.m.Select to move inside the sap.m.OverflowToolbar. Required by the sap.m.IOverflowToolbarContent interface.

getRequired

Gets current value of property required.

Indicates that user input is required. This property is only needed for accessibility purposes when a single relationship between the field and a label (see aggregation labelFor of sap.m.Label) cannot be established (e.g. one label should label multiple fields).

Default value is false.

getResetOnMissingKey

Gets current value of property resetOnMissingKey.

Modifies the behavior of the setSelectedKey method so that the selected item is cleared when a provided selected key is missing.

Default value is false.

getSelectedItem

Gets the selected item object from the aggregation named items.

getSelectedItemId

Gets current value of property selectedItemId.

ID of the selected item.

Default value is empty string.

getSelectedKey

Gets current value of property selectedKey.

Key of the selected item.

Notes:

  • If duplicate keys exist, the first item matching the key is used.
  • If invalid or none selectedKey is used, the first item is being selected.
  • Invalid or missing selectedKey leads to severe functional issues in sap.ui.table.Table, when the sap.m.Select is used inside a sap.ui.table.Table column.

Default value is empty string.

getShowSecondaryValues

Gets current value of property showSecondaryValues.

Indicates whether the text values of the additionalText property of a sap.ui.core.ListItem are shown.

Default value is false.

getTextAlign

Gets current value of property textAlign.

Sets the horizontal alignment of the text within the input field.

Default value is Initial.

getTextDirection

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.

getType

Gets current value of property type.

Type of a select. Possible values Default, IconOnly.

Default value is Default.

getValueState

Gets current value of property valueState.

Visualizes the validation state of the control, e.g. Error, Warning, Success, Information.

Default value is None.

getValueStateText

Gets current value of property valueStateText.

Defines the text of the value state message popup. If this is not specified, a default text is shown from the resource bundle.

Default value is empty string.

getWidth

Gets current value of property width.

Sets the width of the field. By default, the field width is automatically adjusted to the size of its content and the default width of the field is calculated based on the widest list item in the dropdown list. If the width defined is smaller than its content, only the field width is changed whereas the dropdown list keeps the width of its content. If the dropdown list is wider than the visual viewport, it is truncated and an ellipsis is displayed for each item. For phones, the width of the dropdown 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".

getWrapItemsText

Gets current value of property wrapItemsText.

Determines whether the text in the items wraps on multiple lines when the available width is not enough. When the text is truncated (wrapItemsText property is set to false), the max width of the SelectList is 600px. When wrapItemsText is set to true, SelectList takes all of the available width.

Default value is false.

indexOfItem

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

insertItem

Inserts an item into the aggregation named items.

isOpen

Indicates whether the control's picker popup is opened.

open

Open the control's picker popup.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAllItems

Removes all the items in the aggregation named items. Additionally unregisters them from the hosting UIArea.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

removeItem

Removes an item from the aggregation named items.

setAutoAdjustWidth

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.

setColumnRatio

Sets a new value for property columnRatio.

Determines the ratio between the first and the second column when secondary values are displayed.

Note: This property takes effect only when the showSecondaryValues 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 "3:2".

setEditable

Sets a new value for property editable.

Determines whether the user can modify the selected item. When the property is set to false, the control appears as disabled but CAN still be focused.

Note: When both enabled and editable properties are set to false, enabled has priority over editable.

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.

Determines whether the user can modify the selected item. When the property is set to false, the control appears as disabled and CANNOT be focused.

Note: When both enabled and editable properties are set to false, enabled has priority over editable.

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

Default value is true.

setForceSelection

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.

setIcon

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 empty string.

setMaxWidth

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%".

setName

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 empty string.

setRequired

Sets a new value for property required.

Indicates that user input is required. This property is only needed for accessibility purposes when a single relationship between the field and a label (see aggregation labelFor of sap.m.Label) cannot be established (e.g. one label should label multiple fields).

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

Default value is false.

setResetOnMissingKey

Sets a new value for property resetOnMissingKey.

Modifies the behavior of the setSelectedKey method so that the selected item is cleared when a provided selected key is missing.

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

Default value is false.

setSelectedItem

Sets the selectedItem association.

Default value is null.

setSelectedItemId

Sets the selectedItemId property.

Default value is an empty string "" or undefined.

setSelectedKey

Sets property selectedKey.

Default value is an empty string "" or undefined.

setShowSecondaryValues

Sets a new value for property showSecondaryValues.

Indicates whether the text values of the additionalText property of a sap.ui.core.ListItem are shown.

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

Default value is false.

setTextAlign

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.

setTextDirection

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.

setType

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.

setValueState

Sets a new value for property valueState.

Visualizes the validation state of the control, e.g. Error, Warning, Success, Information.

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

Default value is None.

setValueStateText

Sets a new value for property valueStateText.

Defines the text of the value state message popup. If this is not specified, a default text is shown from the resource bundle.

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

Default value is empty string.

setWidth

Sets a new value for property width.

Sets the width of the field. By default, the field width is automatically adjusted to the size of its content and the default width of the field is calculated based on the widest list item in the dropdown list. If the width defined is smaller than its content, only the field width is changed whereas the dropdown list keeps the width of its content. If the dropdown list is wider than the visual viewport, it is truncated and an ellipsis is displayed for each item. For phones, the width of the dropdown 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".

setWrapItemsText

Sets the wrapItemsText property.

unbindItems

Unbinds aggregation items from model data.

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 an item to the aggregation named items.

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

The item to be added; if empty, nothing is added.

attachChange

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:

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.Select 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

close

Closes the control's picker popup.

createPicker

Creates a picker popup container where the selection should take place.

Param Type DefaultValue Description
sPickerType string

The picker type

destroyItems

Destroys all the items in the aggregation named items.

detachChange

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.

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.m.Select.extend

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.

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

fireChange

Fires event change to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

selectedItem sap.ui.core.Item

The selected item.

previousSelectedItem sap.ui.core.Item

The previous selected item.

getAccessibilityInfo

Returns the sap.m.Select accessibility information.

References:

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getAutoAdjustWidth

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.

getColumnRatio

Gets current value of property columnRatio.

Determines the ratio between the first and the second column when secondary values are displayed.

Note: This property takes effect only when the showSecondaryValues property is set to true.

Default value is "3:2".

getEditable

Gets current value of property editable.

Determines whether the user can modify the selected item. When the property is set to false, the control appears as disabled but CAN still be focused.

Note: When both enabled and editable properties are set to false, enabled has priority over editable.

Default value is true.

getEnabled

Gets current value of property enabled.

Determines whether the user can modify the selected item. When the property is set to false, the control appears as disabled and CANNOT be focused.

Note: When both enabled and editable properties are set to false, enabled has priority over editable.

Default value is true.

getEnabledItems

Gets the enabled items from the aggregation named items.

Param Type DefaultValue Description
aItems sap.ui.core.Item[] getItems()

Items to filter.

getFirstItem

Gets the first item from the aggregation named items.

getFocusDomRef

Returns the DOM Element that should get the focus.

getForceSelection

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.

getIcon

Gets current value of property icon.

The URI to the icon that will be displayed only when using the IconOnly type.

Default value is empty string.

getIdForLabel

Returns the DOMNode Id to be used for the "labelFor" attribute of the label.

By default, this is the Id of the control itself.

getItemAt

Gets the item from the aggregation named items at the given 0-based index.

Param Type DefaultValue Description
iIndex int

Index of the item to return.

getItemByKey

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.

Param Type DefaultValue Description
sKey string

An item key that specifies the item to be retrieved.

getItems

Gets aggregation items.

Note: This is the default aggregation.

getLastItem

Gets the last item from the aggregation named items.

getMaxWidth

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%".

sap.m.Select.getMetadata

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

getName

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 empty string.

getOverflowToolbarConfig

Enables the sap.m.Select to move inside the sap.m.OverflowToolbar. Required by the sap.m.IOverflowToolbarContent interface.

getRequired

Gets current value of property required.

Indicates that user input is required. This property is only needed for accessibility purposes when a single relationship between the field and a label (see aggregation labelFor of sap.m.Label) cannot be established (e.g. one label should label multiple fields).

Default value is false.

getResetOnMissingKey

Gets current value of property resetOnMissingKey.

Modifies the behavior of the setSelectedKey method so that the selected item is cleared when a provided selected key is missing.

Default value is false.

getSelectedItem

Gets the selected item object from the aggregation named items.

getSelectedItemId

Gets current value of property selectedItemId.

ID of the selected item.

Default value is empty string.

getSelectedKey

Gets current value of property selectedKey.

Key of the selected item.

Notes:

Default value is empty string.

getShowSecondaryValues

Gets current value of property showSecondaryValues.

Indicates whether the text values of the additionalText property of a sap.ui.core.ListItem are shown.

Default value is false.

getTextAlign

Gets current value of property textAlign.

Sets the horizontal alignment of the text within the input field.

Default value is Initial.

getTextDirection

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.

getType

Gets current value of property type.

Type of a select. Possible values Default, IconOnly.

Default value is Default.

getValueState

Gets current value of property valueState.

Visualizes the validation state of the control, e.g. Error, Warning, Success, Information.

Default value is None.

getValueStateText

Gets current value of property valueStateText.

Defines the text of the value state message popup. If this is not specified, a default text is shown from the resource bundle.

Default value is empty string.

getWidth

Gets current value of property width.

Sets the width of the field. By default, the field width is automatically adjusted to the size of its content and the default width of the field is calculated based on the widest list item in the dropdown list. If the width defined is smaller than its content, only the field width is changed whereas the dropdown list keeps the width of its content. If the dropdown list is wider than the visual viewport, it is truncated and an ellipsis is displayed for each item. For phones, the width of the dropdown 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".

getWrapItemsText

Gets current value of property wrapItemsText.

Determines whether the text in the items wraps on multiple lines when the available width is not enough. When the text is truncated (wrapItemsText property is set to false), the max width of the SelectList is 600px. When wrapItemsText is set to true, SelectList takes all of the available width.

Default value is false.

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 an item into the aggregation named items.

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

The item to be inserted; 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.

isOpen

Indicates whether the control's picker popup is opened.

open

Open the control's picker popup.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAllItems

Removes all the items in the aggregation named items. Additionally unregisters them from the hosting UIArea.

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 an item from the aggregation named items.

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

The item to be removed or its index or ID.

setAutoAdjustWidth

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.

Param Type DefaultValue Description
bAutoAdjustWidth boolean false

New value for property autoAdjustWidth

setColumnRatio

Sets a new value for property columnRatio.

Determines the ratio between the first and the second column when secondary values are displayed.

Note: This property takes effect only when the showSecondaryValues 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 "3:2".

Param Type DefaultValue Description
sColumnRatio sap.m.SelectColumnRatio "3:2"

New value for property columnRatio

setEditable

Sets a new value for property editable.

Determines whether the user can modify the selected item. When the property is set to false, the control appears as disabled but CAN still be focused.

Note: When both enabled and editable properties are set to false, enabled has priority over editable.

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.

Determines whether the user can modify the selected item. When the property is set to false, the control appears as disabled and CANNOT be focused.

Note: When both enabled and editable properties are set to false, enabled has priority over editable.

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

setForceSelection

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.

Param Type DefaultValue Description
bForceSelection boolean true

New value for property forceSelection

setIcon

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 empty string.

Param Type DefaultValue Description
sIcon sap.ui.core.URI ""

New value for property icon

setMaxWidth

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%".

Param Type DefaultValue Description
sMaxWidth sap.ui.core.CSSSize "100%"

New value for property maxWidth

setName

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 empty string.

Param Type DefaultValue Description
sName string ""

New value for property name

setRequired

Sets a new value for property required.

Indicates that user input is required. This property is only needed for accessibility purposes when a single relationship between the field and a label (see aggregation labelFor of sap.m.Label) cannot be established (e.g. one label should label multiple fields).

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

Default value is false.

Param Type DefaultValue Description
bRequired boolean false

New value for property required

setResetOnMissingKey

Sets a new value for property resetOnMissingKey.

Modifies the behavior of the setSelectedKey method so that the selected item is cleared when a provided selected key is missing.

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

Default value is false.

Param Type DefaultValue Description
bResetOnMissingKey boolean false

New value for property resetOnMissingKey

setSelectedItem

Sets the selectedItem association.

Default value is null.

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

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).

setSelectedItemId

Sets the selectedItemId property.

Default value is an empty string "" or undefined.

Param Type DefaultValue Description
vItem string

New value for property selectedItemId. If the provided vItem has a default value, the first enabled item will be selected (if any items exist).

setSelectedKey

Sets property selectedKey.

Default value is an empty string "" or undefined.

Param Type DefaultValue Description
sKey string

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.

setShowSecondaryValues

Sets a new value for property showSecondaryValues.

Indicates whether the text values of the additionalText property of a sap.ui.core.ListItem are shown.

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

Default value is false.

Param Type DefaultValue Description
bShowSecondaryValues boolean false

New value for property showSecondaryValues

setTextAlign

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.

Param Type DefaultValue Description
sTextAlign sap.ui.core.TextAlign Initial

New value for property textAlign

setTextDirection

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.

Param Type DefaultValue Description
sTextDirection sap.ui.core.TextDirection Inherit

New value for property textDirection

setType

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.

Param Type DefaultValue Description
sType sap.m.SelectType Default

New value for property type

setValueState

Sets a new value for property valueState.

Visualizes the validation state of the control, e.g. Error, Warning, Success, Information.

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

setValueStateText

Sets a new value for property valueStateText.

Defines the text of the value state message popup. If this is not specified, a default text is shown from the resource bundle.

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

Default value is empty string.

Param Type DefaultValue Description
sValueStateText string ""

New value for property valueStateText

setWidth

Sets a new value for property width.

Sets the width of the field. By default, the field width is automatically adjusted to the size of its content and the default width of the field is calculated based on the widest list item in the dropdown list. If the width defined is smaller than its content, only the field width is changed whereas the dropdown list keeps the width of its content. If the dropdown list is wider than the visual viewport, it is truncated and an ellipsis is displayed for each item. For phones, the width of the dropdown 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".

Param Type DefaultValue Description
sWidth sap.ui.core.CSSSize "auto"

New value for property width

setWrapItemsText

Sets the wrapItemsText property.

Param Type DefaultValue Description
bWrap boolean

unbindItems

Unbinds aggregation items from model data.