sap.ui.commons.ListBox.extend(sClassName, oClassInfo?, FNMetaImpl?): function
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.
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.ui.commons.ListBox.
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:
Returns:
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.
Parameters:
{int} | iSelectedIndex | Index to add to selection.. |
Returns:
Adds the given indices to selection. Any invalid indices are ignored.
Parameters:
{int[]} | aSelectedIndices | Indices of the items that shall additionally be selected. |
Returns:
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.
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.ui.commons.ListBox itself |
Returns:
Removes complete selection.
Returns:
Destroys all the items in the aggregation items
.
Returns:
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.
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:
id
of type string
ID of the ListBox which triggered the event.selectedIndex
of type 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
of type 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
of type int[]
Array containing the indices which are selected.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
getAllowMultiSelect(): boolean
Gets current value of property
allowMultiSelect
.
Determines whether multiple selection is allowed.
Default value is false
.
Returns:
{boolean} | Value of property allowMultiSelect |
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:
getDisplayIcons(): boolean
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
.
Returns:
{boolean} | Value of property displayIcons |
getDisplaySecondaryValues(): boolean
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
.
Returns:
{boolean} | Value of property displaySecondaryValues |
getEditable(): boolean
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
.
Returns:
{boolean} | Value of property editable |
getEnabled(): boolean
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
.
Returns:
{boolean} | Value of property enabled |
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.
Returns:
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.
Returns:
Gets current value of property
maxWidth
.
Determines the maximum width of the ListBox. If not set, there is no maximum width.
Returns:
Gets current value of property
minWidth
.
Determines the minimum width of the ListBox. If not set, there is no minimum width.
Returns:
getScrollTop(): int
Returns how many pixels the ListBox contents are currently scrolled down.
Returns:
{int} | Vertical scroll position. |
Gets current value of property
secondaryValueTextAlign
.
Determines the text alignment in the secondary ListBox text column (if available).
Default value is Begin
.
Returns:
getSelectedIndex(): int
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.
Returns:
getSelectedIndices(): int[]
Zero-based indices of selected items, wrapped in an array. An empty array means "no selection".
Returns:
{int[]} | Array of selected indices. |
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.
Returns:
Returns an array containing the selected items. In the case of no selection, an empty array is returned.
Returns:
getSelectedKeys(): string[]
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.
Returns:
{string[]} | Array with selected keys. |
Gets current value of property
valueTextAlign
.
Determines the text alignment in the primary ListBox column.
Default value is Begin
.
Returns:
getVisibleItems(): int
Returns the number of visible items.
Returns:
{int} | Number of visible items. |
Gets current value of property
width
.
Control width as common CSS-size (px or % as unit, for example).
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 a item into the aggregation items
.
Parameters:
{sap.ui.core.Item} | 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 |
Returns:
isIndexSelected(iIndex): boolean
Returns whether the given index is selected.
Parameters:
{int} | iIndex | Index which is checked for selection state. |
Returns:
{boolean} | Whether index is selected. |
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.
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:
Returns:
Removes the given index from this selection. When the index is invalid or not selected, the call is ignored.
Parameters:
{int} | iIndex | Index that shall be removed from selection. |
Returns:
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".
Parameters:
{int} | iIndex | The index to which the ListBox should scroll. |
{boolean} | bLazy | 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). |
Returns:
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
.
Parameters:
{boolean} | bAllowMultiSelect | New value for property allowMultiSelect |
Returns:
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
.
Parameters:
{boolean} | bDisplayIcons | New value for property displayIcons |
Returns:
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
.
Parameters:
{boolean} | bDisplaySecondaryValues | New value for property displaySecondaryValues |
Returns:
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
.
Parameters:
{boolean} | bEditable | New value for property editable |
Returns:
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
.
Parameters:
{boolean} | bEnabled | New value for property enabled |
Returns:
Sets the height of this ListBox in CSS units.
Parameters:
Returns:
Allows setting the list items as array for this instance of ListBox.
Parameters:
{sap.ui.core.ListItem[]} | aItems | The items to set for this ListBox. |
{boolean} | bDestroyItems | Optional boolean parameter to indicate that the formerly set items should be destroyed, instead of just removed. |
Returns:
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.
Parameters:
Returns:
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.
Parameters:
Returns:
Positions the ListBox contents so that they are scrolled-down by the given number of pixels.
Parameters:
{int} | iScrollTop | Vertical scroll position in pixels. |
Returns:
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
.
Parameters:
Returns:
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.
Parameters:
{int} | iSelectedIndex | Index to be selected. |
Returns:
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.
Parameters:
{int[]} | aSelectedIndices | Indices of the items to be selected. |
Returns:
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.
Parameters:
{string[]} | aSelectedKeys | The keys of the items to be selected. |
Returns:
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
.
Parameters:
Returns:
Makes the ListBox render with a height that allows it to display exactly the given number of items.
Parameters:
{int} | iItemCount | The number of items that should fit into the ListBox without scrolling. |
Returns:
Sets the width of this ListBox in CSS units.
Parameters:
Returns: