Class sap.m.MultiInputModule: sap/m/MultiInput

extends Input

MultiInput provides functionality to add / remove / enter tokens

Constructor Summary
new sap.m.MultiInput(sId?, mSettings?)Constructor for a new MultiInput.
Fields borrowed from class sap.m.InputBase
Event Summary
tokenChange(oControlEvent)Fired when the tokens aggregation changed (add / remove token)
Events borrowed from class sap.m.InputBase
Events borrowed from class sap.ui.core.Control
Method Summary
sap.m.MultiInput.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.m.MultiInput with name sClassName and enriches it with the information contained in oClassInfo.
sap.m.MultiInput.getMetadata()Returns a metadata object for class sap.m.MultiInput.
addToken(oToken)Adds some token to the aggregation tokens.
addValidator(fValidator)Function adds an validation callback called before any new token gets added to the tokens aggregation
attachTokenChange(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the tokenChange event of this sap.m.MultiInput.
clone()Function overwrites clone function to add tokens to MultiInput
closeMultiLine()Close multi-line MultiInput in multi-line mode
destroyTokens()Destroys all the tokens in the aggregation tokens.
detachTokenChange(fnFunction, oListener)Detaches event handler fnFunction from the tokenChange event of this sap.m.MultiInput.
fireTokenChange(mArguments?)Fires event tokenChange to attached listeners.
getDomRefForValueStateMessage()Get the reference element which the message popup should dock to
getEnableMultiLineMode()Gets current value of property enableMultiLineMode.
getMaxTokens()Gets current value of property maxTokens.
getPopupAnchorDomRef()Function returns domref which acts as reference point for the opening suggestion menu
getTokens()Gets content of aggregation tokens.
indexOfToken(oToken)Checks for the provided sap.m.Token in the aggregation tokens.
insertToken(oToken, iIndex)Inserts a token into the aggregation tokens.
onfocusin(oEvent)Focus is on MultiInput
onsapescape(oEvent)When press ESC, deselect all tokens and all texts
ontap(oEvent)When tap on text field, deselect all tokens
openMultiLine()Expand multi-line MultiInput in multi-line mode
removeAllTokens()Removes all the controls from the aggregation tokens.
removeAllValidators()Function removes all validation callbacks
removeToken(vToken)Removes a token from the aggregation tokens.
removeValidator(fValidator)Function removes an validation callback
setEnableMultiLineMode()Setter for property enableMultiLineMode.
setMaxTokens(iMaxTokens)Sets a new value for property maxTokens.
setTokens(aTokens)Function sets an array of tokens, existing tokens will get overridden
Methods borrowed from class sap.m.Input
addSuggestionColumn, addSuggestionItem, addSuggestionRow, attachLiveChange, attachSubmit, attachSuggest, attachSuggestionItemSelected, attachValueHelpRequest, bindAggregation, bindSuggestionColumns, bindSuggestionRows, destroySuggestionColumns, destroySuggestionItems, destroySuggestionRows, detachLiveChange, detachSubmit, detachSuggest, detachSuggestionItemSelected, detachValueHelpRequest, fireLiveChange, fireSubmit, fireSuggest, fireSuggestionItemSelected, fireValueHelpRequest, getDateFormat, getDescription, getFieldWidth, getFilterSuggests, getMaxLength, getMaxSuggestionWidth, getShowSuggestion, getShowTableSuggestionValueHelp, getShowValueHelp, getShowValueStateMessage, getStartSuggestion, getSuggestionColumns, getSuggestionItems, getSuggestionRows, getType, getValueHelpOnly, getValueLiveUpdate, getValueStateText, getWidth, indexOfSuggestionColumn, indexOfSuggestionItem, indexOfSuggestionRow, insertSuggestionColumn, insertSuggestionItem, insertSuggestionRow, removeAllSuggestionColumns, removeAllSuggestionItems, removeAllSuggestionRows, removeSuggestionColumn, removeSuggestionItem, removeSuggestionRow, setDateFormat, setDescription, setFieldWidth, setFilterFunction, setFilterSuggests, setMaxLength, setMaxSuggestionWidth, setRowResultFunction, setShowSuggestion, setShowTableSuggestionValueHelp, setShowValueHelp, setShowValueStateMessage, setStartSuggestion, setType, setValue, setValueHelpOnly, setValueLiveUpdate, setValueStateText, setWidth, unbindSuggestionColumns, unbindSuggestionRows
Constructor Detail
new sap.m.MultiInput(sId?, mSettings?)
Constructor for a new MultiInput.

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
  • Aggregations
  • Events
    • tokenChange : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]

In addition, all settings applicable to the base type sap.m.Input 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
tokenChange(oControlEvent)
Fired when the tokens aggregation changed (add / remove token)
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string}oControlEvent.getParameters.type Type of tokenChange event. There are four TokenChange types: "added", "removed", "removedAll", "tokensChanged". Use Tokenizer.TokenChangeType.Added for "added", Tokenizer.TokenChangeType.Removed for "removed", Tokenizer.TokenChangeType.RemovedAll for "removedAll" and Tokenizer.TokenChangeType.TokensChanged for "tokensChanged".
{sap.m.Token}oControlEvent.getParameters.token The added token or removed token. This parameter is used when tokenChange type is "added" or "removed".
{sap.m.Token[]}oControlEvent.getParameters.tokens The array of removed tokens. This parameter is used when tokenChange type is "removedAll".
{sap.m.Token[]}oControlEvent.getParameters.addedTokens The array of tokens that are added. This parameter is used when tokenChange type is "tokenChanged".
{sap.m.Token[]}oControlEvent.getParameters.removedTokens The array of tokens that are removed. This parameter is used when tokenChange type is "tokenChanged".
Method Detail
sap.m.MultiInput.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.m.MultiInput 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.Input.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.MultiInput.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.m.MultiInput.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
addToken(oToken): sap.m.MultiInput
Adds some token to the aggregation tokens.
Parameters:
{sap.m.Token}oToken the token to add; if empty, nothing is inserted
Returns:
{sap.m.MultiInput} Reference to this in order to allow method chaining
addValidator(fValidator)
Function adds an validation callback called before any new token gets added to the tokens aggregation
Parameters:
{function}fValidator
attachTokenChange(oData?, fnFunction, oListener?): sap.m.MultiInput
Attaches event handler fnFunction to the tokenChange event of this sap.m.MultiInput.

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

Fired when the tokens aggregation changed (add / remove token)

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.MultiInput itself
Returns:
{sap.m.MultiInput} Reference to this in order to allow method chaining
Function overwrites clone function to add tokens to MultiInput
Returns:
{sap.ui.core.Element} reference to the newly created clone
closeMultiLine()
Close multi-line MultiInput in multi-line mode
Since:
1.28
destroyTokens(): sap.m.MultiInput
Destroys all the tokens in the aggregation tokens.
Returns:
{sap.m.MultiInput} Reference to this in order to allow method chaining
detachTokenChange(fnFunction, oListener): sap.m.MultiInput
Detaches event handler fnFunction from the tokenChange event of this sap.m.MultiInput.

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.MultiInput} Reference to this in order to allow method chaining
fireTokenChange(mArguments?): sap.m.MultiInput
Fires event tokenChange to attached listeners.

Expects the following event parameters:

  • type of type stringType of tokenChange event. There are four TokenChange types: "added", "removed", "removedAll", "tokensChanged". Use Tokenizer.TokenChangeType.Added for "added", Tokenizer.TokenChangeType.Removed for "removed", Tokenizer.TokenChangeType.RemovedAll for "removedAll" and Tokenizer.TokenChangeType.TokensChanged for "tokensChanged".
  • token of type sap.m.TokenThe added token or removed token. This parameter is used when tokenChange type is "added" or "removed".
  • tokens of type sap.m.Token[]The array of removed tokens. This parameter is used when tokenChange type is "removedAll".
  • addedTokens of type sap.m.Token[]The array of tokens that are added. This parameter is used when tokenChange type is "tokenChanged".
  • removedTokens of type sap.m.Token[]The array of tokens that are removed. This parameter is used when tokenChange type is "tokenChanged".
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.m.MultiInput} Reference to this in order to allow method chaining
getAccessibilityInfo()
See:
{sap.ui.core.Control#getAccessibilityInfo}
getDomRefForValueStateMessage(): DOMRef
Get the reference element which the message popup should dock to
Returns:
{DOMRef} Dom Element which the message popup should dock to
getEnableMultiLineMode(): boolean
Gets current value of property enableMultiLineMode.

If set to true, the MultiInput will be displayed in multi-line display mode. In multi-line display mode, all tokens can be fully viewed and easily edited in the MultiInput. The default value is false. Note: This property does not take effect on smartphones.

Default value is false.

Since:
1.28
Returns:
{boolean} Value of property enableMultiLineMode
getMaxTokens(): int
Gets current value of property maxTokens.

The max number of tokens that is allowed in MultiInput.

Since:
1.36
Returns:
{int} Value of property maxTokens
getPopupAnchorDomRef(): domRef
Function returns domref which acts as reference point for the opening suggestion menu
Returns:
{domRef} the domref at which to open the suggestion menu
getTokens(): sap.m.Token[]
Gets content of aggregation tokens.

The currently displayed tokens

Returns:
{sap.m.Token[]}
indexOfToken(oToken): int
Checks for the provided sap.m.Token in the aggregation tokens. and returns its index if found or -1 otherwise.
Parameters:
{sap.m.Token}oToken The token whose index is looked for
Returns:
{int} The index of the provided control in the aggregation if found, or -1 otherwise
insertToken(oToken, iIndex): sap.m.MultiInput
Inserts a token into the aggregation tokens.
Parameters:
{sap.m.Token}oToken the token to insert; if empty, nothing is inserted
{int}iIndex the 0-based index the token should be inserted at; for a negative value of iIndex, the token is inserted at position 0; for a value greater than the current size of the aggregation, the token is inserted at the last position
Returns:
{sap.m.MultiInput} Reference to this in order to allow method chaining
onfocusin(oEvent)
Focus is on MultiInput
Parameters:
{jQuery.Event}oEvent
onsapescape(oEvent)
When press ESC, deselect all tokens and all texts
Parameters:
{jQuery.Event}oEvent
ontap(oEvent)
When tap on text field, deselect all tokens
Parameters:
{jQuery.Event}oEvent
openMultiLine()
Expand multi-line MultiInput in multi-line mode
Since:
1.28
removeAllTokens(): sap.m.Token[]
Removes all the controls from the aggregation tokens.

Additionally, it unregisters them from the hosting UIArea.

Returns:
{sap.m.Token[]} An array of the removed elements (might be empty)
removeAllValidators()
Function removes all validation callbacks
removeToken(vToken): sap.m.Token
Removes a token from the aggregation tokens.
Parameters:
{int|string|sap.m.Token}vToken The tokento remove or its index or id
Returns:
{sap.m.Token} The removed token or null
removeValidator(fValidator)
Function removes an validation callback
Parameters:
{function}fValidator
setEnableMultiLineMode()
Setter for property enableMultiLineMode.
Since:
1.28
setMaxTokens(iMaxTokens): sap.m.MultiInput
Sets a new value for property maxTokens.

The max number of tokens that is allowed in MultiInput.

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

Parameters:
{int}iMaxTokens New value for property maxTokens
Since:
1.36
Returns:
{sap.m.MultiInput} Reference to this in order to allow method chaining
setTokens(aTokens): sap.m.MultiInput
Function sets an array of tokens, existing tokens will get overridden
Parameters:
{sap.m.Token[]}aTokens the new token set
Returns:
{sap.m.MultiInput} Pointer to the control instance for chaining