Class sap.m.ComboBoxBaseModule: sap/m/ComboBoxBase

known direct subclasses: ComboBox, MultiComboBox

An abstract class for combo boxes.


Since: 1.22.0.
Constructor Summary
new sap.m.ComboBoxBase(sId?, mSettings?)Constructor for a new sap.m.ComboBoxBase.
Event Summary
loadItems(oControlEvent)This event is fired when the end user moves the cursor to the text field, performs an action that requires items to be loaded, and items are not already loaded.
Events borrowed from class sap.m.InputBase
Events borrowed from class sap.ui.core.Control
Method Summary
sap.m.ComboBoxBase.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.m.ComboBoxBase with name sClassName and enriches it with the information contained in oClassInfo.
sap.m.ComboBoxBase.getMetadata()Returns a metadata object for class sap.m.ComboBoxBase.
addItem(oItem)Adds an item to the aggregation named items.
attachLoadItems(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the loadItems event of this sap.m.ComboBoxBase.
bindItems(oBindingInfo)Binds aggregation items to model data.
clearSelection()Clears the selection.
close()Closes the control's picker popup.
createPicker(sPickerType)Creates a picker popup container where the selection should take place.
destroyItems()Destroys all the items in the aggregation named items.
detachLoadItems(fnFunction, oListener)Detaches event handler fnFunction from the loadItems event of this sap.m.ComboBoxBase.
fireLoadItems(mArguments?)Fires event loadItems to attached listeners.
getEnabledItems(aItems?)Gets the enabled items from the aggregation named items.
getFirstItem()Gets the first item from the aggregation named items.
getItemAt(iIndex)Gets the item from the aggregation named items at the given 0-based index.
getItemByKey(sKey)Gets the item with the given key from the aggregation named items.
getItems()Gets content of aggregation items.
getLastItem()Gets the last item from the aggregation named items.
getList()Gets the list.
getPicker()Gets the control's picker popup.
getPickerType()Gets the property _sPickerType
indexOfItem(oItem)Checks for the provided sap.ui.core.Item in the aggregation items.
insertItem(oItem, iIndex)Inserts an item into the aggregation named items.
isOpen()Indicates whether the control's picker popup is open.
open()Opens the control's picker popup.
removeAllItems()Removes all the controls in the aggregation named items.
removeItem(vItem)Removes an item from the aggregation named items.
setPickerType(sPickerType)Sets the property _sPickerType.
unbindItems()Unbinds aggregation items from model data.
Constructor Detail
new sap.m.ComboBoxBase(sId?, mSettings?)
Constructor for a new sap.m.ComboBoxBase.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.

The supported settings are:

  • Aggregations
    • items : sap.ui.core.Item[] (default)
  • Events
    • loadItems : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]

In addition, all settings applicable to the base type sap.m.ComboBoxTextField can be used as well.

Parameters:
{string}sId? ID for the new control, generated automatically if no ID is given.
{object}mSettings? Initial settings for the new control.
Event Detail
loadItems(oControlEvent)
This event is fired when the end user moves the cursor to the text field, performs an action that requires items to be loaded, and items are not already loaded. For example, pressing F4 to open the dropdown list or typing something in the text field fires the event.

Note: We strongly recommend to only use this feature in performance critical scenarios. Loading the items lazily (on demand) to defer initialization has several implications for the end user experience. For example, the busy indicator has to be shown while the items are being loaded and assistive technology software also has to announce the state changes (which may be confusing for some screen reader users).

Note: Currently the sap.m.MultiComboBox does not support this event.

Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
Since:
1.38
Method Detail
sap.m.ComboBoxBase.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.m.ComboBoxBase with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.m.ComboBoxTextField.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
sap.m.ComboBoxBase.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.m.ComboBoxBase.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
addItem(oItem): sap.m.ComboBoxBase
Adds an item to the aggregation named items.
Parameters:
{sap.ui.core.Item}oItem The item to be added; if empty, nothing is added.
Returns:
{sap.m.ComboBoxBase}this to allow method chaining.
attachLoadItems(oData?, fnFunction, oListener?): sap.m.ComboBoxBase
Attaches event handler fnFunction to the loadItems event of this sap.m.ComboBoxBase.

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

This event is fired when the end user moves the cursor to the text field, performs an action that requires items to be loaded, and items are not already loaded. For example, pressing F4 to open the dropdown list or typing something in the text field fires the event.

Note: We strongly recommend to only use this feature in performance critical scenarios. Loading the items lazily (on demand) to defer initialization has several implications for the end user experience. For example, the busy indicator has to be shown while the items are being loaded and assistive technology software also has to announce the state changes (which may be confusing for some screen reader users).

Note: Currently the sap.m.MultiComboBox does not support this event.

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.ComboBoxBase itself
Since:
1.38
Returns:
{sap.m.ComboBoxBase} Reference to this in order to allow method chaining
bindItems(oBindingInfo): sap.m.ComboBoxBase
Binds aggregation items to model data.

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

Parameters:
{object}oBindingInfo The binding information
Returns:
{sap.m.ComboBoxBase} Reference to this in order to allow method chaining
clearSelection()
Clears the selection. To be overwritten by subclasses.
Closes the control's picker popup.
Returns:
{sap.m.ComboBoxBase}this to allow method chaining.
createPicker(sPickerType): sap.m.Popover|sap.m.Dialog
Creates a picker popup container where the selection should take place. To be overwritten by subclasses.
Parameters:
{string}sPickerType
Returns:
{sap.m.Popover|sap.m.Dialog} The picker popup to be used.
destroyItems(): sap.m.ComboBox
Destroys all the items in the aggregation named items.
Returns:
{sap.m.ComboBox}this to allow method chaining.
detachLoadItems(fnFunction, oListener): sap.m.ComboBoxBase
Detaches event handler fnFunction from the loadItems event of this sap.m.ComboBoxBase.

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
Since:
1.38
Returns:
{sap.m.ComboBoxBase} Reference to this in order to allow method chaining
fireLoadItems(mArguments?): sap.m.ComboBoxBase
Fires event loadItems to attached listeners.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Since:
1.38
Returns:
{sap.m.ComboBoxBase} Reference to this in order to allow method chaining
getEnabledItems(aItems?): sap.ui.core.Item[]
Gets the enabled items from the aggregation named items.
Parameters:
{sap.ui.core.Item[]}aItems?, Default: getItems() Items to filter.
Returns:
{sap.ui.core.Item[]} An array containing the enabled items.
getFirstItem(): sap.ui.core.Item
Gets the first item from the aggregation named items.
Returns:
{sap.ui.core.Item} The first item, or null if there are no items.
getItemAt(iIndex): sap.ui.core.Item
Gets the item from the aggregation named items at the given 0-based index.
Parameters:
{int}iIndex Index of the item to return.
Returns:
{sap.ui.core.Item} Item at the given index, or null if none.
getItemByKey(sKey): sap.ui.core.Item
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 retrieve.
Returns:
{sap.ui.core.Item}
getItems(): sap.ui.core.Item[]
Gets content of aggregation items.

Defines the items contained within this control.

Returns:
{sap.ui.core.Item[]}
getLastItem(): sap.ui.core.Item
Gets the last item from the aggregation named items.
Returns:
{sap.ui.core.Item} The last item, or null if there are no items.
getList(): sap.m.SelectList
Gets the list.
Returns:
{sap.m.SelectList} The list instance object or null.
getPicker(): sap.m.Dialog|sap.m.Popover|null
Gets the control's picker popup.
Returns:
{sap.m.Dialog|sap.m.Popover|null} The picker instance, creating it if necessary by calling the createPicker() method.
getPickerType(): string
Gets the property _sPickerType
Returns:
{string}
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:
{sap.ui.core.Item}oItem The item whose index is looked for
Returns:
{int} The index of the provided control in the aggregation if found, or -1 otherwise
insertItem(oItem, iIndex): sap.m.ComboBoxBase
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:
{sap.m.ComboBoxBase}this to allow method chaining.
isOpen(): boolean
Indicates whether the control's picker popup is open.
Returns:
{boolean} Determines whether the control's picker popup is currently open (this includes opening and closing animations).
Opens the control's picker popup.
Returns:
{sap.m.ComboBoxBase}this to allow method chaining.
removeAllItems(): sap.ui.core.Item[]
Removes all the controls in the aggregation named items. Additionally unregisters them from the hosting UIArea and clears the selection.
Returns:
{sap.ui.core.Item[]} An array of the removed items (might be empty).
removeItem(vItem): sap.ui.core.Item
Removes an item from the aggregation named items.
Parameters:
{int|string|sap.ui.core.Item}vItem The item to remove or its index or ID.
Returns:
{sap.ui.core.Item} The removed item or null.
setPickerType(sPickerType)
Sets the property _sPickerType.
Parameters:
{string}sPickerType
unbindItems(): sap.m.ComboBoxBase
Unbinds aggregation items from model data.
Returns:
{sap.m.ComboBoxBase} Reference to this in order to allow method chaining