Class sap.m.MultiComboBoxModule: sap/m/MultiComboBox

extends ComboBoxBase

The MultiComboBox control provides a list box with items and a text field allowing the user to either type a value directly into the control or choose from the list of existing items.


Since: 1.22.0.
Constructor Summary
new sap.m.MultiComboBox(sId?, mSettings?)Constructor for a new MultiComboBox.
Event Summary
selectionChange(oControlEvent)Event is fired when selection of an item is changed.
selectionFinish(oControlEvent)Event is fired when user has finished a selection of items in a list box and list box has been closed.
Events borrowed from class sap.m.ComboBoxBase
Events borrowed from class sap.m.InputBase
Events borrowed from class sap.ui.core.Control
Method Summary
sap.m.MultiComboBox.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.m.MultiComboBox with name sClassName and enriches it with the information contained in oClassInfo.
sap.m.MultiComboBox.getMetadata()Returns a metadata object for class sap.m.MultiComboBox.
addSelectedItem(oItem)Adds some item oItem to the association named selectedItems.
addSelectedKeys(aKeys)Adds selected items.
attachSelectionChange(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the selectionChange event of this sap.m.MultiComboBox.
attachSelectionFinish(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the selectionFinish event of this sap.m.MultiComboBox.
clearSelection()Clear the selection.
createPicker(sPickerType)Creates a picker.
destroyItems()Destroys all the items in the aggregation named items.
detachSelectionChange(fnFunction, oListener)Detaches event handler fnFunction from the selectionChange event of this sap.m.MultiComboBox.
detachSelectionFinish(fnFunction, oListener)Detaches event handler fnFunction from the selectionFinish event of this sap.m.MultiComboBox.
fireSelectionChange(mArguments?)Fires event selectionChange to attached listeners.
fireSelectionFinish(mArguments?)Fires event selectionFinish to attached listeners.
getEnabledItems(aItems?)Gets the enabled items from the aggregation named items.
getItemByKey(sKey)Gets the item with the given key from the aggregation named items.
getSelectedItems()Retrieves the selected item objects from the association named selectedItems.
getSelectedKeys()Gets current value of property selectedKeys.
insertItem(oItem, iIndex)Inserts an item into the aggregation named items.
onAfterRenderingPicker()This hook method is called after the MultiComboBox's Pop-up is rendered.
onBeforeRenderingPicker()This hook method is called before the MultiComboBox's Pop-up is rendered.
removeAllItems()Removes all the items in the aggregation named items.
removeAllSelectedItems()Removes all the controls in the association named selectedItems.
removeItem(oItem)Removes an item from the aggregation named items.
removeSelectedItem(vSelectedItem)Removes an selectedItem from the association named selectedItems.
removeSelectedKeys(aKeys)Removes selected items.
setSelectedItems(aItems)Setter for association selectedItems.
setSelectedKeys(sSelectedKeys)Sets a new value for property selectedKeys.
Constructor Detail
new sap.m.MultiComboBox(sId?, mSettings?)
Constructor for a new MultiComboBox.

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:

  • Properties
  • Events
    • selectionChange : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
    • selectionFinish : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]

In addition, all settings applicable to the base type sap.m.ComboBoxBase 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
selectionChange(oControlEvent)
Event is fired when selection of an item is changed. Note: please do not use the "change" event inherited from sap.m.InputBase
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{sap.ui.core.Item}oControlEvent.getParameters.changedItem Item which selection is changed
{boolean}oControlEvent.getParameters.selected Selection state: true if item is selected, false if item is not selected
selectionFinish(oControlEvent)
Event is fired when user has finished a selection of items in a list box and list box has been closed.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{sap.ui.core.Item[]}oControlEvent.getParameters.selectedItems The selected items which are selected after list box has been closed.
Method Detail
sap.m.MultiComboBox.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.m.MultiComboBox 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.ComboBoxBase.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.MultiComboBox.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.m.MultiComboBox.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
addSelectedItem(oItem): sap.m.MultiComboBox
Adds some item oItem to the association named selectedItems.
Parameters:
{sap.ui.core.Item}oItem The selected item to add; if empty, nothing is added.
Returns:
{sap.m.MultiComboBox}this to allow method chaining.
addSelectedKeys(aKeys): sap.m.MultiComboBox
Adds selected items. Only items with valid keys are added as selected.
Parameters:
{string[]}aKeys An array of item keys that identifies the items to be added as selected
Returns:
{sap.m.MultiComboBox}
attachSelectionChange(oData?, fnFunction, oListener?): sap.m.MultiComboBox
Attaches event handler fnFunction to the selectionChange event of this sap.m.MultiComboBox.

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

Event is fired when selection of an item is changed. Note: please do not use the "change" event inherited from sap.m.InputBase

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.MultiComboBox itself
Returns:
{sap.m.MultiComboBox} Reference to this in order to allow method chaining
attachSelectionFinish(oData?, fnFunction, oListener?): sap.m.MultiComboBox
Attaches event handler fnFunction to the selectionFinish event of this sap.m.MultiComboBox.

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

Event is fired when user has finished a selection of items in a list box and list box has been closed.

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.MultiComboBox itself
Returns:
{sap.m.MultiComboBox} Reference to this in order to allow method chaining
clearSelection()
Clear the selection.
createPicker(sPickerType): sap.m.Popover|sap.m.Dialog
Creates a picker. To be overwritten by subclasses.
Parameters:
{string}sPickerType
Returns:
{sap.m.Popover|sap.m.Dialog} The picker pop-up to be used.
destroyItems(): sap.m.MultiComboBox
Destroys all the items in the aggregation named items.
Returns:
{sap.m.MultiComboBox}this to allow method chaining.
detachSelectionChange(fnFunction, oListener): sap.m.MultiComboBox
Detaches event handler fnFunction from the selectionChange event of this sap.m.MultiComboBox.

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

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Returns:
{sap.m.MultiComboBox} Reference to this in order to allow method chaining
detachSelectionFinish(fnFunction, oListener): sap.m.MultiComboBox
Detaches event handler fnFunction from the selectionFinish event of this sap.m.MultiComboBox.

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

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Returns:
{sap.m.MultiComboBox} Reference to this in order to allow method chaining
fireSelectionChange(mArguments?): sap.m.MultiComboBox
Fires event selectionChange to attached listeners.

Expects the following event parameters:

  • changedItem of type sap.ui.core.ItemItem which selection is changed
  • selected of type booleanSelection state: true if item is selected, false if item is not selected
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.m.MultiComboBox} Reference to this in order to allow method chaining
fireSelectionFinish(mArguments?): sap.m.MultiComboBox
Fires event selectionFinish to attached listeners.

Expects the following event parameters:

  • selectedItems of type sap.ui.core.Item[]The selected items which are selected after list box has been closed.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.m.MultiComboBox} Reference to this in order to allow method chaining
getAccessibilityInfo()
See:
{sap.ui.core.Control#getAccessibilityInfo}
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.
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}
getSelectedItems(): sap.ui.core.Item[]
Retrieves the selected item objects from the association named selectedItems.
Returns:
{sap.ui.core.Item[]} Array of sap.ui.core.Item instances. The current target of the selectedItems association.
getSelectedKeys(): string[]
Gets current value of property selectedKeys.

Keys of the selected items. If the key has no corresponding item, no changes will apply. If duplicate keys exists the first item matching the key is used.

Default value is [].

Returns:
{string[]} Value of property selectedKeys
insertItem(oItem, iIndex): sap.m.MultiComboBox
Inserts an item into the aggregation named 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:
{sap.m.MultiComboBox}this to allow method chaining.
onAfterRenderingPicker()
This hook method is called after the MultiComboBox's Pop-up is rendered.
onBeforeRenderingPicker()
This hook method is called before the MultiComboBox's Pop-up is rendered.
removeAllItems(): sap.ui.core.Item[]
Removes all the items in the aggregation named items.
Returns:
{sap.ui.core.Item[]} An array of sap.ui.core.Item of the removed items (might be empty).
removeAllSelectedItems(): sap.ui.core.Item[]
Removes all the controls in the association named selectedItems.
Returns:
{sap.ui.core.Item[]} An array of the removed elements (might be empty)
removeItem(oItem): sap.ui.core.Item
Removes an item from the aggregation named items.
Parameters:
{int|string|sap.ui.core.Item}oItem The item to remove or its index or id.
Returns:
{sap.ui.core.Item} The removed item or null.
removeSelectedItem(vSelectedItem): sap.ui.core.Item
Removes an selectedItem from the association named selectedItems.
Parameters:
{int|string|sap.ui.core.Item}vSelectedItem The selectedItemto be removed or its index or ID
Returns:
{sap.ui.core.Item} the removed selectedItem or null
removeSelectedKeys(aKeys): sap.m.MultiComboBox
Removes selected items. Only items with valid keys are removed.
Parameters:
{string[]}aKeys An array of item keys that identifies the items to be removed
Returns:
{sap.m.MultiComboBox}
setSelectedItems(aItems): sap.m.MultiComboBox
Setter for association selectedItems.
Parameters:
{string[]|sap.ui.core.Item[]|null}aItems new values for association selectedItems. Array of sap.ui.core.Item Id which becomes the new target of this selectedItems association. Alternatively, an array of sap.ui.core.Item instance may be given or null.
Returns:
{sap.m.MultiComboBox}this to allow method chaining.
setSelectedKeys(sSelectedKeys): sap.m.MultiComboBox
Sets a new value for property selectedKeys.

Keys of the selected items. If the key has no corresponding item, no changes will apply. If duplicate keys exists the first item matching the key is used.

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

Default value is [].

Parameters:
{string[]}sSelectedKeys New value for property selectedKeys
Returns:
{sap.m.MultiComboBox} Reference to this in order to allow method chaining