class sap.ui.commons.ListBox

Control sample: sap.ui.commons.ListBox
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/commons/ListBox
Application Component: CA-UI5-CTR

Provides a list of items from which users can choose an item. For the design of the list box, features such as defining the list box height, fixing the number of visible items, choosing one item to be the item that is marked by default when the list box is shown, or a scroll bar for large list boxes are available.


Constructor

Constructor for a new ListBox.

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.ListBox(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
allowMultiSelect boolean false

Determines whether multiple selection is allowed.

Visibility: public
displayIcons boolean false

Determines whether the icons of the list items shall also be displayed. Enabling icons requires some space to be reserved for them. Displaying icons can also influence the width and height of a single item, which affects the overall height of the ListBox when defined in number of items. Note that the number of icons that can be displayed in the ListBox depends on the size of the icons themselves and of the total ListBox height.

Visibility: public
displaySecondaryValues boolean false

Determines whether the text values from the additionalText property (see sap.ui.core.ListItems) shall be displayed.

Visibility: public
editable boolean true

Determines whether the ListBox is interactive or not. Can be used to disable interaction with mouse or keyboard.

Visibility: public
enabled boolean true

Determines whether the ListBox is enabled or not. Can be used to disable interaction with mouse or keyboard. Disabled controls have another color display depending on custom settings.

Visibility: public
height sap.ui.core.CSSSize

Control height as common CSS-size (px or % as unit, for example). The setting overrides any definitions made for the setVisibleItems() method.

Visibility: public
maxWidth sap.ui.core.CSSSize

Determines the maximum width of the ListBox. If not set, there is no maximum width.

Visibility: public
minWidth sap.ui.core.CSSSize

Determines the minimum width of the ListBox. If not set, there is no minimum width.

Visibility: public
scrollTop int -1

Scroll bar position from the top. Setting the scrollTop property and calling scrollToIndex are two operations influencing the same "physical" property, so the last call "wins".

Visibility: public
secondaryValueTextAlign sap.ui.core.TextAlign Begin

Determines the text alignment in the secondary ListBox text column (if available).

Visibility: public
valueTextAlign sap.ui.core.TextAlign Begin

Determines the text alignment in the primary ListBox column.

Visibility: public
visibleItems int

The ListBox height in number of items that are initially displayed without scrolling. This setting overwrites height settings in terms of CSS size that have been made. When the items have different heights, the height of the first item is used for all other item height calculations. Note that if there are one or more separators between the visible ListBox items, the displayed items might not relate 1:1 to the initially specified number of items. When the value is retrieved, it equals the previously set value if it was set; otherwise, it will be the number of items completely fitting into the ListBox without scrolling in the case the control was already rendered. Note that if the control was not rendered, the behavior will be undefined, it may return -1 or any other number.

Visibility: public
width sap.ui.core.CSSSize

Control width as common CSS-size (px or % as unit, for example).

Visibility: public

Aggregations

Default Aggregation: items

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

Aggregation of items to be displayed. Must be either of type sap.ui.core.ListItem or sap.ui.core.SeparatorItem.


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

Event is fired when selection is changed by user interaction.

select

Event is fired when selection is changed by user interaction.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
id string

ID of the ListBox which triggered the event.

selectedIndex int

The currently selected index of the ListBox. In the case of multiple selection, this is exactly one of the selected indices - the one whose selection has triggered the selection change. To get all currently selected indices, use selectedIndices.

selectedItem sap.ui.core.Item

The currently selected item of the ListBox. In the case of multiple selection, this is exactly one of the selected items - the one whose selection has triggered the selection change.

selectedIndices int[]

Array containing the indices which are selected.


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.

addSelectedIndex

Adds the given index to current selection. When multiple selection is disabled, this replaces the current selection. When the given index is invalid, the call is ignored.

addSelectedIndices

Adds the given indices to selection. Any invalid indices are ignored.

attachSelect

Attaches event handler fnFunction to the select event of this sap.ui.commons.ListBox.

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.ListBox itself.

Event is fired when selection is changed by user interaction.

clearSelection

Removes complete selection.

destroyItems

Destroys all the items in the aggregation items.

detachSelect

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

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

sap.ui.commons.ListBox.extend

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

getAllowMultiSelect

Gets current value of property allowMultiSelect.

Determines whether multiple selection is allowed.

Default value is false.

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.

getDisplayIcons

Gets current value of property displayIcons.

Determines whether the icons of the list items shall also be displayed. Enabling icons requires some space to be reserved for them. Displaying icons can also influence the width and height of a single item, which affects the overall height of the ListBox when defined in number of items. Note that the number of icons that can be displayed in the ListBox depends on the size of the icons themselves and of the total ListBox height.

Default value is false.

getDisplaySecondaryValues

Gets current value of property displaySecondaryValues.

Determines whether the text values from the additionalText property (see sap.ui.core.ListItems) shall be displayed.

Default value is false.

getEditable

Gets current value of property editable.

Determines whether the ListBox is interactive or not. Can be used to disable interaction with mouse or keyboard.

Default value is true.

getEnabled

Gets current value of property enabled.

Determines whether the ListBox is enabled or not. Can be used to disable interaction with mouse or keyboard. Disabled controls have another color display depending on custom settings.

Default value is true.

getHeight

Gets current value of property height.

Control height as common CSS-size (px or % as unit, for example). The setting overrides any definitions made for the setVisibleItems() method.

getItems

Gets content of aggregation items.

Aggregation of items to be displayed. Must be either of type sap.ui.core.ListItem or sap.ui.core.SeparatorItem.

getMaxWidth

Gets current value of property maxWidth.

Determines the maximum width of the ListBox. If not set, there is no maximum width.

sap.ui.commons.ListBox.getMetadata

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

getMinWidth

Gets current value of property minWidth.

Determines the minimum width of the ListBox. If not set, there is no minimum width.

getScrollTop

Returns how many pixels the ListBox contents are currently scrolled down.

getSecondaryValueTextAlign

Gets current value of property secondaryValueTextAlign.

Determines the text alignment in the secondary ListBox text column (if available).

Default value is Begin.

getSelectedIndex

Zero-based index of selected item. Index value for no selection is -1. When multiple selection is enabled and multiple items are selected, the method returns the first selected item.

getSelectedIndices

Zero-based indices of selected items, wrapped in an array. An empty array means "no selection".

getSelectedItem

Returns selected item. When no item is selected, "null" is returned. When multi-selection is enabled and multiple items are selected, only the first selected item is returned.

getSelectedItems

Returns an array containing the selected items. In the case of no selection, an empty array is returned.

getSelectedKeys

Returns the keys of the selected items in an array. If a selected item does not have a key, the respective array entry will be undefined.

getValueTextAlign

Gets current value of property valueTextAlign.

Determines the text alignment in the primary ListBox column.

Default value is Begin.

getVisibleItems

Returns the number of visible items.

getWidth

Gets current value of property width.

Control width as common CSS-size (px or % as unit, for example).

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.

isIndexSelected

Returns whether the given index is selected.

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.

removeSelectedIndex

Removes the given index from this selection. When the index is invalid or not selected, the call is ignored.

scrollToIndex

If the ListBox has a scroll bar because the number of items is larger than the number of visible items, this method scrolls to the item with the given index. If there are enough items, this item will then appear at the topmost visible position in the ListBox. If bLazy is true, it only scrolls as far as required to make the item visible. Setting the scrollTop property and calling scrollToIndex are two operations influencing the same "physical" property, so the last call "wins".

setAllowMultiSelect

Sets a new value for property allowMultiSelect.

Determines whether multiple selection is allowed.

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

Default value is false.

setDisplayIcons

Sets a new value for property displayIcons.

Determines whether the icons of the list items shall also be displayed. Enabling icons requires some space to be reserved for them. Displaying icons can also influence the width and height of a single item, which affects the overall height of the ListBox when defined in number of items. Note that the number of icons that can be displayed in the ListBox depends on the size of the icons themselves and of the total ListBox height.

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

Default value is false.

setDisplaySecondaryValues

Sets a new value for property displaySecondaryValues.

Determines whether the text values from the additionalText property (see sap.ui.core.ListItems) shall be displayed.

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

Default value is false.

setEditable

Sets a new value for property editable.

Determines whether the ListBox is interactive or not. Can be used to disable interaction with mouse or keyboard.

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 ListBox is enabled or not. Can be used to disable interaction with mouse or keyboard. Disabled controls have another color display depending on custom settings.

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

Default value is true.

setHeight

Sets the height of this ListBox in CSS units.

setItems

Allows setting the list items as array for this instance of ListBox.

setMaxWidth

Sets a new value for property maxWidth.

Determines the maximum width of the ListBox. If not set, there is no maximum width.

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

setMinWidth

Sets a new value for property minWidth.

Determines the minimum width of the ListBox. If not set, there is no minimum width.

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

setScrollTop

Positions the ListBox contents so that they are scrolled-down by the given number of pixels.

setSecondaryValueTextAlign

Sets a new value for property secondaryValueTextAlign.

Determines the text alignment in the secondary ListBox text column (if available).

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

Default value is Begin.

setSelectedIndex

Sets the zero-based index of the currently selected item. This method removes any previous selections. When the given index is invalid, the call is ignored.

setSelectedIndices

Zero-based indices of selected items, wrapped in an array. An empty array means "no selection". When multiple selection is disabled and multiple items are given, the selection is set to the index of the first valid index in the given array. Any invalid indices are ignored. The previous selection is in any case replaced.

setSelectedKeys

Keys of the items to be selected, wrapped in an array. An empty array means no selection. When multiple selection is disabled, and multiple keys are given, the selection is set to the item with the first valid key in the given array. Any invalid keys are ignored. The previous selection is replaced in any case.

setValueTextAlign

Sets a new value for property valueTextAlign.

Determines the text alignment in the primary ListBox column.

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

Default value is Begin.

setVisibleItems

Makes the ListBox render with a height that allows it to display exactly the given number of items.

setWidth

Sets the width of this ListBox in CSS units.

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

addSelectedIndex

Adds the given index to current selection. When multiple selection is disabled, this replaces the current selection. When the given index is invalid, the call is ignored.

Param Type DefaultValue Description
iSelectedIndex int

Index to add to selection..

addSelectedIndices

Adds the given indices to selection. Any invalid indices are ignored.

Param Type DefaultValue Description
aSelectedIndices int[]

Indices of the items that shall additionally be selected.

attachSelect

Attaches event handler fnFunction to the select event of this sap.ui.commons.ListBox.

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.ListBox itself.

Event is fired 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.ListBox itself

clearSelection

Removes complete selection.

destroyItems

Destroys all the items in the aggregation items.

detachSelect

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

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.ListBox.extend

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

id string

ID of the ListBox which triggered the event.

selectedIndex int

The currently selected index of the ListBox. In the case of multiple selection, this is exactly one of the selected indices - the one whose selection has triggered the selection change. To get all currently selected indices, use selectedIndices.

selectedItem sap.ui.core.Item

The currently selected item of the ListBox. In the case of multiple selection, this is exactly one of the selected items - the one whose selection has triggered the selection change.

selectedIndices int[]

Array containing the indices which are selected.

getAllowMultiSelect

Gets current value of property allowMultiSelect.

Determines whether multiple selection is allowed.

Default value is false.

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.

getDisplayIcons

Gets current value of property displayIcons.

Determines whether the icons of the list items shall also be displayed. Enabling icons requires some space to be reserved for them. Displaying icons can also influence the width and height of a single item, which affects the overall height of the ListBox when defined in number of items. Note that the number of icons that can be displayed in the ListBox depends on the size of the icons themselves and of the total ListBox height.

Default value is false.

getDisplaySecondaryValues

Gets current value of property displaySecondaryValues.

Determines whether the text values from the additionalText property (see sap.ui.core.ListItems) shall be displayed.

Default value is false.

getEditable

Gets current value of property editable.

Determines whether the ListBox is interactive or not. Can be used to disable interaction with mouse or keyboard.

Default value is true.

getEnabled

Gets current value of property enabled.

Determines whether the ListBox is enabled or not. Can be used to disable interaction with mouse or keyboard. Disabled controls have another color display depending on custom settings.

Default value is true.

getHeight

Gets current value of property height.

Control height as common CSS-size (px or % as unit, for example). The setting overrides any definitions made for the setVisibleItems() method.

getItems

Gets content of aggregation items.

Aggregation of items to be displayed. Must be either of type sap.ui.core.ListItem or sap.ui.core.SeparatorItem.

getMaxWidth

Gets current value of property maxWidth.

Determines the maximum width of the ListBox. If not set, there is no maximum width.

sap.ui.commons.ListBox.getMetadata

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

getMinWidth

Gets current value of property minWidth.

Determines the minimum width of the ListBox. If not set, there is no minimum width.

getScrollTop

Returns how many pixels the ListBox contents are currently scrolled down.

getSecondaryValueTextAlign

Gets current value of property secondaryValueTextAlign.

Determines the text alignment in the secondary ListBox text column (if available).

Default value is Begin.

getSelectedIndex

Zero-based index of selected item. Index value for no selection is -1. When multiple selection is enabled and multiple items are selected, the method returns the first selected item.

getSelectedIndices

Zero-based indices of selected items, wrapped in an array. An empty array means "no selection".

getSelectedItem

Returns selected item. When no item is selected, "null" is returned. When multi-selection is enabled and multiple items are selected, only the first selected item is returned.

getSelectedItems

Returns an array containing the selected items. In the case of no selection, an empty array is returned.

getSelectedKeys

Returns the keys of the selected items in an array. If a selected item does not have a key, the respective array entry will be undefined.

getValueTextAlign

Gets current value of property valueTextAlign.

Determines the text alignment in the primary ListBox column.

Default value is Begin.

getVisibleItems

Returns the number of visible items.

getWidth

Gets current value of property width.

Control width as common CSS-size (px or % as unit, for example).

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

isIndexSelected

Returns whether the given index is selected.

Param Type DefaultValue Description
iIndex int

Index which is checked for selection state.

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

removeSelectedIndex

Removes the given index from this selection. When the index is invalid or not selected, the call is ignored.

Param Type DefaultValue Description
iIndex int

Index that shall be removed from selection.

scrollToIndex

If the ListBox has a scroll bar because the number of items is larger than the number of visible items, this method scrolls to the item with the given index. If there are enough items, this item will then appear at the topmost visible position in the ListBox. If bLazy is true, it only scrolls as far as required to make the item visible. Setting the scrollTop property and calling scrollToIndex are two operations influencing the same "physical" property, so the last call "wins".

Param Type DefaultValue Description
iIndex int

The index to which the ListBox should scroll.

bLazy boolean

If set to true, the ListBox only scrolls if the item is not completely visible, and it scrolls for exactly the space to make it fully visible. If set to false, the item is scrolled to the top position (if possible).

setAllowMultiSelect

Sets a new value for property allowMultiSelect.

Determines whether multiple selection is allowed.

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
bAllowMultiSelect boolean false

New value for property allowMultiSelect

setDisplayIcons

Sets a new value for property displayIcons.

Determines whether the icons of the list items shall also be displayed. Enabling icons requires some space to be reserved for them. Displaying icons can also influence the width and height of a single item, which affects the overall height of the ListBox when defined in number of items. Note that the number of icons that can be displayed in the ListBox depends on the size of the icons themselves and of the total ListBox height.

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
bDisplayIcons boolean false

New value for property displayIcons

setDisplaySecondaryValues

Sets a new value for property displaySecondaryValues.

Determines whether the text values from the additionalText property (see sap.ui.core.ListItems) shall be displayed.

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
bDisplaySecondaryValues boolean false

New value for property displaySecondaryValues

setEditable

Sets a new value for property editable.

Determines whether the ListBox is interactive or not. Can be used to disable interaction with mouse or keyboard.

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 ListBox is enabled or not. Can be used to disable interaction with mouse or keyboard. Disabled controls have another color display depending on custom settings.

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

setHeight

Sets the height of this ListBox in CSS units.

Param Type DefaultValue Description
sHeight sap.ui.core.CSSSize

New height for the ListBox.

setItems

Allows setting the list items as array for this instance of ListBox.

Param Type DefaultValue Description
aItems sap.ui.core.ListItem[]

The items to set for this ListBox.

bDestroyItems boolean

Optional boolean parameter to indicate that the formerly set items should be destroyed, instead of just removed.

setMaxWidth

Sets a new value for property maxWidth.

Determines the maximum width of the ListBox. If not set, there is no maximum width.

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

Param Type DefaultValue Description
sMaxWidth sap.ui.core.CSSSize

New value for property maxWidth

setMinWidth

Sets a new value for property minWidth.

Determines the minimum width of the ListBox. If not set, there is no minimum width.

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

Param Type DefaultValue Description
sMinWidth sap.ui.core.CSSSize

New value for property minWidth

setScrollTop

Positions the ListBox contents so that they are scrolled-down by the given number of pixels.

Param Type DefaultValue Description
iScrollTop int

Vertical scroll position in pixels.

setSecondaryValueTextAlign

Sets a new value for property secondaryValueTextAlign.

Determines the text alignment in the secondary ListBox text column (if available).

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

Default value is Begin.

Param Type DefaultValue Description
sSecondaryValueTextAlign sap.ui.core.TextAlign Begin

New value for property secondaryValueTextAlign

setSelectedIndex

Sets the zero-based index of the currently selected item. This method removes any previous selections. When the given index is invalid, the call is ignored.

Param Type DefaultValue Description
iSelectedIndex int

Index to be selected.

setSelectedIndices

Zero-based indices of selected items, wrapped in an array. An empty array means "no selection". When multiple selection is disabled and multiple items are given, the selection is set to the index of the first valid index in the given array. Any invalid indices are ignored. The previous selection is in any case replaced.

Param Type DefaultValue Description
aSelectedIndices int[]

Indices of the items to be selected.

setSelectedKeys

Keys of the items to be selected, wrapped in an array. An empty array means no selection. When multiple selection is disabled, and multiple keys are given, the selection is set to the item with the first valid key in the given array. Any invalid keys are ignored. The previous selection is replaced in any case.

Param Type DefaultValue Description
aSelectedKeys string[]

The keys of the items to be selected.

setValueTextAlign

Sets a new value for property valueTextAlign.

Determines the text alignment in the primary ListBox column.

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

Default value is Begin.

Param Type DefaultValue Description
sValueTextAlign sap.ui.core.TextAlign Begin

New value for property valueTextAlign

setVisibleItems

Makes the ListBox render with a height that allows it to display exactly the given number of items.

Param Type DefaultValue Description
iItemCount int

The number of items that should fit into the ListBox without scrolling.

setWidth

Sets the width of this ListBox in CSS units.

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

New width for the ListBox.