class sap.m.SearchField

Control sample: sap.m.SearchField
Visiblity: public
UX Guidelines: Search Field
Implements: sap.ui.core.IFormContentsap.f.IShellBar
Available since: N/A
Module: sap/m/SearchField
Application Component: CA-UI5-CTR

An input field to search for a specific item.

Overview

A search field is needed when the user needs to find specific information in large amounts of data. The search field is also the control of choice for filtering down a given amount of information.

Structure

The search input field can be used in two ways:

Usage

When to use:

Responsive Behavior

On mobile devices, there is no refresh button in the search field. "Pull Down to Refresh" is used instead. The "Pull Down to Refresh" arrow icon is animated and spins to signal that the user should release it.


Constructor

Constructor for a new SearchField.

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.m.SearchField(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
enableSuggestions boolean false

If true, a suggest event is fired when user types in the input and when the input is focused. On a phone device, a full screen dialog with suggestions is always shown even if the suggestions list is empty.

Since: 1.34.

Visibility: public
enabled boolean true

Boolean property to enable the control (default is true).

Visibility: public
maxLength int 0

Maximum number of characters. Value '0' means the feature is switched off.

Visibility: public
placeholder string

Text shown when no value available. If no placeholder value is set, the word "Search" in the current local language (if supported) or in English will be displayed as a placeholder (property value will still be null in that case).

Visibility: public
refreshButtonTooltip string

Tooltip text of the refresh button. If it is not set, the Default tooltip text is the word "Refresh" in the current local language (if supported) or in English. Tooltips are not displayed on touch devices.

Since: 1.16.

Visibility: public
selectOnFocus boolean true

Normally, search text is selected for copy when the SearchField is focused by keyboard navigation. If an application re-renders the SearchField during the liveChange event, set this property to false to disable text selection by focus.

Since: 1.20.

Visibility: public
showMagnifier boolean true

Set to false to hide the magnifier icon.

Visibility: public
showRefreshButton boolean false

Set to true to display a refresh button in place of the search icon. By pressing the refresh button or F5 key on keyboard, the user can reload the results list without changing the search string.

Since: 1.16.

Visibility: public
showSearchButton boolean true

Set to true to show the search button with the magnifier icon. If false, both the search and refresh buttons are not displayed even if the "showRefreshButton" property is true.

Since: 1.23.

Visibility: public
value string

Input Value.

Visibility: public
visible boolean true

Invisible inputs are not rendered.

Visibility: public
width sap.ui.core.CSSSize

Defines the CSS width of the input. If not set, width is 100%.

Visibility: public

Aggregations

Default Aggregation: suggestionItems

Name Cardinality Type Description
suggestionItems (default) 0..n sap.m.SuggestionItem

SuggestionItems are the items which will be shown in the suggestions list. The following properties can be used:

  • key is not displayed and may be used as internal technical field
  • text is displayed as normal suggestion text
  • icon
  • description - additional text may be used to visually display search item type or category


Since: 1.34.


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
change

This event is fired when the user changes the value of the search field. Unlike the liveChange event, the change event is not fired for each key press.

Since: 1.77.

liveChange

This event is fired each time when the value of the search field is changed by the user - e.g. at each key press. Do not invalidate a focused search field, especially during the liveChange event.

Since: 1.9.1.

search

Event which is fired when the user triggers a search.

suggest

This event is fired when the search field is initially focused or its value is changed by the user. This event means that suggestion data should be updated, in case if suggestions are used. Use the value parameter to create new suggestions for it.

Since: 1.34.

change

This event is fired when the user changes the value of the search field. Unlike the liveChange event, the change event is not fired for each key press.

Since: 1.77.

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

The new value of the control.

liveChange

This event is fired each time when the value of the search field is changed by the user - e.g. at each key press. Do not invalidate a focused search field, especially during the liveChange event.

Since: 1.9.1.

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

Current search string.

search

Event which is fired when the user triggers a search.

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

The search query string.

suggestionItem sap.m.SuggestionItem

Suggestion list item in case if the user has selected an item from the suggestions list.

Since: 1.34.

refreshButtonPressed boolean

Indicates if the user pressed the refresh icon.

Since: 1.16.

clearButtonPressed boolean

Indicates if the user pressed the clear icon.

Since: 1.34.

suggest

This event is fired when the search field is initially focused or its value is changed by the user. This event means that suggestion data should be updated, in case if suggestions are used. Use the value parameter to create new suggestions for it.

Since: 1.34.

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

Current search string of the search field.


Methods Overview

Method Description
addAriaDescribedBy

Adds some ariaDescribedBy into the association ariaDescribedBy.

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

addSuggestionItem

Adds some suggestionItem to the aggregation suggestionItems.

attachChange

Attaches event handler fnFunction to the change event of this sap.m.SearchField.

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

This event is fired when the user changes the value of the search field. Unlike the liveChange event, the change event is not fired for each key press.

attachLiveChange

Attaches event handler fnFunction to the liveChange event of this sap.m.SearchField.

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

This event is fired each time when the value of the search field is changed by the user - e.g. at each key press. Do not invalidate a focused search field, especially during the liveChange event.

attachSearch

Attaches event handler fnFunction to the search event of this sap.m.SearchField.

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

Event which is fired when the user triggers a search.

attachSuggest

Attaches event handler fnFunction to the suggest event of this sap.m.SearchField.

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

This event is fired when the search field is initially focused or its value is changed by the user. This event means that suggestion data should be updated, in case if suggestions are used. Use the value parameter to create new suggestions for it.

bindValue

Binds property value to model data.

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

destroySuggestionItems

Destroys all the suggestionItems in the aggregation suggestionItems.

detachChange

Detaches event handler fnFunction from the change event of this sap.m.SearchField.

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

detachLiveChange

Detaches event handler fnFunction from the liveChange event of this sap.m.SearchField.

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

detachSearch

Detaches event handler fnFunction from the search event of this sap.m.SearchField.

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

detachSuggest

Detaches event handler fnFunction from the suggest event of this sap.m.SearchField.

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

sap.m.SearchField.extend

Creates a new subclass of class sap.m.SearchField 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.

fireChange

Fires event change to attached listeners.

fireLiveChange

Fires event liveChange to attached listeners.

fireSearch

Fires event search to attached listeners.

fireSuggest

Fires event suggest to attached listeners.

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.

getEnabled

Gets current value of property enabled.

Boolean property to enable the control (default is true).

Default value is true.

getEnableSuggestions

Gets current value of property enableSuggestions.

If true, a suggest event is fired when user types in the input and when the input is focused. On a phone device, a full screen dialog with suggestions is always shown even if the suggestions list is empty.

Default value is false.

getMaxLength

Gets current value of property maxLength.

Maximum number of characters. Value '0' means the feature is switched off.

Default value is 0.

sap.m.SearchField.getMetadata

Returns a metadata object for class sap.m.SearchField.

getPlaceholder

Gets current value of property placeholder.

Text shown when no value available. If no placeholder value is set, the word "Search" in the current local language (if supported) or in English will be displayed as a placeholder (property value will still be null in that case).

getPopupAnchorDomRef

Function returns DOM element which acts as reference point for the opening suggestion menu

getRefreshButtonTooltip

Gets current value of property refreshButtonTooltip.

Tooltip text of the refresh button. If it is not set, the Default tooltip text is the word "Refresh" in the current local language (if supported) or in English. Tooltips are not displayed on touch devices.

getSelectOnFocus

Gets current value of property selectOnFocus.

Normally, search text is selected for copy when the SearchField is focused by keyboard navigation. If an application re-renders the SearchField during the liveChange event, set this property to false to disable text selection by focus.

Default value is true.

Since 1.38 This parameter is deprecated and has no effect in run time. The cursor position of a focused search field is restored after re-rendering automatically.
getShowMagnifier

Gets current value of property showMagnifier.

Set to false to hide the magnifier icon.

Default value is true.

Since 1.16.0 This parameter is deprecated. Use "showSearchButton" instead.
getShowRefreshButton

Gets current value of property showRefreshButton.

Set to true to display a refresh button in place of the search icon. By pressing the refresh button or F5 key on keyboard, the user can reload the results list without changing the search string.

Default value is false.

getShowSearchButton

Gets current value of property showSearchButton.

Set to true to show the search button with the magnifier icon. If false, both the search and refresh buttons are not displayed even if the "showRefreshButton" property is true.

Default value is true.

getSuggestionItems

Gets content of aggregation suggestionItems.

SuggestionItems are the items which will be shown in the suggestions list. The following properties can be used:

  • key is not displayed and may be used as internal technical field
  • text is displayed as normal suggestion text
  • icon
  • description - additional text may be used to visually display search item type or category

getValue

Gets current value of property value.

Input Value.

getVisible

Gets current value of property visible.

Invisible inputs are not rendered.

Default value is true.

getWidth

Gets current value of property width.

Defines the CSS width of the input. If not set, width is 100%.

indexOfSuggestionItem

Checks for the provided sap.m.SuggestionItem in the aggregation suggestionItems. and returns its index if found or -1 otherwise.

insertSuggestionItem

Inserts a suggestionItem into the aggregation suggestionItems.

removeAllAriaDescribedBy

Removes all the controls in the association named ariaDescribedBy.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAllSuggestionItems

Removes all the controls from the aggregation suggestionItems.

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.

removeSuggestionItem

Removes a suggestionItem from the aggregation suggestionItems.

setEnabled

Sets a new value for property enabled.

Boolean property to enable the control (default is true).

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

Default value is true.

setEnableSuggestions

Sets a new value for property enableSuggestions.

If true, a suggest event is fired when user types in the input and when the input is focused. On a phone device, a full screen dialog with suggestions is always shown even if the suggestions list is empty.

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

Default value is false.

setMaxLength

Sets a new value for property maxLength.

Maximum number of characters. Value '0' means the feature is switched off.

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

Default value is 0.

setPlaceholder

Sets a new value for property placeholder.

Text shown when no value available. If no placeholder value is set, the word "Search" in the current local language (if supported) or in English will be displayed as a placeholder (property value will still be null in that case).

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

setRefreshButtonTooltip

Sets a new value for property refreshButtonTooltip.

Tooltip text of the refresh button. If it is not set, the Default tooltip text is the word "Refresh" in the current local language (if supported) or in English. Tooltips are not displayed on touch devices.

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

setSelectOnFocus

Sets a new value for property selectOnFocus.

Normally, search text is selected for copy when the SearchField is focused by keyboard navigation. If an application re-renders the SearchField during the liveChange event, set this property to false to disable text selection by focus.

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

Default value is true.

Since 1.38 This parameter is deprecated and has no effect in run time. The cursor position of a focused search field is restored after re-rendering automatically.
setShowMagnifier

Sets a new value for property showMagnifier.

Set to false to hide the magnifier icon.

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

Default value is true.

Since 1.16.0 This parameter is deprecated. Use "showSearchButton" instead.
setShowRefreshButton

Sets a new value for property showRefreshButton.

Set to true to display a refresh button in place of the search icon. By pressing the refresh button or F5 key on keyboard, the user can reload the results list without changing the search string.

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

Default value is false.

setShowSearchButton

Sets a new value for property showSearchButton.

Set to true to show the search button with the magnifier icon. If false, both the search and refresh buttons are not displayed even if the "showRefreshButton" property is true.

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

Default value is true.

setValue

Sets a new value for property value.

Input Value.

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

setVisible

Sets a new value for property visible.

Invisible inputs are not rendered.

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

Default value is true.

setWidth

Sets a new value for property width.

Defines the CSS width of the input. If not set, width is 100%.

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

suggest

Toggle visibility of the suggestion list.

unbindValue

Unbinds property value from model data.

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

addSuggestionItem

Adds some suggestionItem to the aggregation suggestionItems.

Param Type DefaultValue Description
oSuggestionItem sap.m.SuggestionItem

The suggestionItem to add; if empty, nothing is inserted

attachChange

Attaches event handler fnFunction to the change event of this sap.m.SearchField.

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

This event is fired when the user changes the value of the search field. Unlike the liveChange event, the change event is not fired for each key press.

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.m.SearchField itself

attachLiveChange

Attaches event handler fnFunction to the liveChange event of this sap.m.SearchField.

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

This event is fired each time when the value of the search field is changed by the user - e.g. at each key press. Do not invalidate a focused search field, especially during the liveChange event.

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.m.SearchField itself

attachSearch

Attaches event handler fnFunction to the search event of this sap.m.SearchField.

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

Event which is fired when the user triggers a search.

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.m.SearchField itself

attachSuggest

Attaches event handler fnFunction to the suggest event of this sap.m.SearchField.

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

This event is fired when the search field is initially focused or its value is changed by the user. This event means that suggestion data should be updated, in case if suggestions are used. Use the value parameter to create new suggestions for it.

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.m.SearchField itself

bindValue

Binds property value to model data.

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

Param Type DefaultValue Description
oBindingInfo sap.ui.base.ManagedObject.PropertyBindingInfo

The binding information

destroySuggestionItems

Destroys all the suggestionItems in the aggregation suggestionItems.

detachChange

Detaches event handler fnFunction from the change event of this sap.m.SearchField.

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

detachLiveChange

Detaches event handler fnFunction from the liveChange event of this sap.m.SearchField.

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

detachSearch

Detaches event handler fnFunction from the search event of this sap.m.SearchField.

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

detachSuggest

Detaches event handler fnFunction from the suggest event of this sap.m.SearchField.

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.m.SearchField.extend

Creates a new subclass of class sap.m.SearchField 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

fireChange

Fires event change to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

value string

The new value of the control.

fireLiveChange

Fires event liveChange to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

newValue string

Current search string.

fireSearch

Fires event search to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

query string

The search query string.

suggestionItem sap.m.SuggestionItem

Suggestion list item in case if the user has selected an item from the suggestions list.

refreshButtonPressed boolean

Indicates if the user pressed the refresh icon.

clearButtonPressed boolean

Indicates if the user pressed the clear icon.

fireSuggest

Fires event suggest to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

suggestValue string

Current search string of the search field.

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.

getEnabled

Gets current value of property enabled.

Boolean property to enable the control (default is true).

Default value is true.

getEnableSuggestions

Gets current value of property enableSuggestions.

If true, a suggest event is fired when user types in the input and when the input is focused. On a phone device, a full screen dialog with suggestions is always shown even if the suggestions list is empty.

Default value is false.

getMaxLength

Gets current value of property maxLength.

Maximum number of characters. Value '0' means the feature is switched off.

Default value is 0.

sap.m.SearchField.getMetadata

Returns a metadata object for class sap.m.SearchField.

getPlaceholder

Gets current value of property placeholder.

Text shown when no value available. If no placeholder value is set, the word "Search" in the current local language (if supported) or in English will be displayed as a placeholder (property value will still be null in that case).

getPopupAnchorDomRef

Function returns DOM element which acts as reference point for the opening suggestion menu

getRefreshButtonTooltip

Gets current value of property refreshButtonTooltip.

Tooltip text of the refresh button. If it is not set, the Default tooltip text is the word "Refresh" in the current local language (if supported) or in English. Tooltips are not displayed on touch devices.

getSelectOnFocus

Gets current value of property selectOnFocus.

Normally, search text is selected for copy when the SearchField is focused by keyboard navigation. If an application re-renders the SearchField during the liveChange event, set this property to false to disable text selection by focus.

Default value is true.

Since 1.38 This parameter is deprecated and has no effect in run time. The cursor position of a focused search field is restored after re-rendering automatically.

getShowMagnifier

Gets current value of property showMagnifier.

Set to false to hide the magnifier icon.

Default value is true.

Since 1.16.0 This parameter is deprecated. Use "showSearchButton" instead.

getShowRefreshButton

Gets current value of property showRefreshButton.

Set to true to display a refresh button in place of the search icon. By pressing the refresh button or F5 key on keyboard, the user can reload the results list without changing the search string.

Default value is false.

getShowSearchButton

Gets current value of property showSearchButton.

Set to true to show the search button with the magnifier icon. If false, both the search and refresh buttons are not displayed even if the "showRefreshButton" property is true.

Default value is true.

getSuggestionItems

Gets content of aggregation suggestionItems.

SuggestionItems are the items which will be shown in the suggestions list. The following properties can be used:

getValue

Gets current value of property value.

Input Value.

getVisible

Gets current value of property visible.

Invisible inputs are not rendered.

Default value is true.

getWidth

Gets current value of property width.

Defines the CSS width of the input. If not set, width is 100%.

indexOfSuggestionItem

Checks for the provided sap.m.SuggestionItem in the aggregation suggestionItems. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oSuggestionItem sap.m.SuggestionItem

The suggestionItem whose index is looked for

insertSuggestionItem

Inserts a suggestionItem into the aggregation suggestionItems.

Param Type DefaultValue Description
oSuggestionItem sap.m.SuggestionItem

The suggestionItem to insert; if empty, nothing is inserted

iIndex int

The 0-based index the suggestionItem should be inserted at; for a negative value of iIndex, the suggestionItem is inserted at position 0; for a value greater than the current size of the aggregation, the suggestionItem is inserted at the last position

removeAllAriaDescribedBy

Removes all the controls in the association named ariaDescribedBy.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAllSuggestionItems

Removes all the controls from the aggregation suggestionItems.

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

removeSuggestionItem

Removes a suggestionItem from the aggregation suggestionItems.

Param Type DefaultValue Description
vSuggestionItem int string sap.m.SuggestionItem

The suggestionItem to remove or its index or id

setEnabled

Sets a new value for property enabled.

Boolean property to enable the control (default is true).

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

setEnableSuggestions

Sets a new value for property enableSuggestions.

If true, a suggest event is fired when user types in the input and when the input is focused. On a phone device, a full screen dialog with suggestions is always shown even if the suggestions list is empty.

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

New value for property enableSuggestions

setMaxLength

Sets a new value for property maxLength.

Maximum number of characters. Value '0' means the feature is switched off.

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

Default value is 0.

Param Type DefaultValue Description
iMaxLength int 0

New value for property maxLength

setPlaceholder

Sets a new value for property placeholder.

Text shown when no value available. If no placeholder value is set, the word "Search" in the current local language (if supported) or in English will be displayed as a placeholder (property value will still be null in that case).

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

Param Type DefaultValue Description
sPlaceholder string

New value for property placeholder

setRefreshButtonTooltip

Sets a new value for property refreshButtonTooltip.

Tooltip text of the refresh button. If it is not set, the Default tooltip text is the word "Refresh" in the current local language (if supported) or in English. Tooltips are not displayed on touch devices.

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

Param Type DefaultValue Description
sRefreshButtonTooltip string

New value for property refreshButtonTooltip

setSelectOnFocus

Sets a new value for property selectOnFocus.

Normally, search text is selected for copy when the SearchField is focused by keyboard navigation. If an application re-renders the SearchField during the liveChange event, set this property to false to disable text selection by focus.

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

Default value is true.

Since 1.38 This parameter is deprecated and has no effect in run time. The cursor position of a focused search field is restored after re-rendering automatically.
Param Type DefaultValue Description
bSelectOnFocus boolean true

New value for property selectOnFocus

setShowMagnifier

Sets a new value for property showMagnifier.

Set to false to hide the magnifier icon.

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

Default value is true.

Since 1.16.0 This parameter is deprecated. Use "showSearchButton" instead.
Param Type DefaultValue Description
bShowMagnifier boolean true

New value for property showMagnifier

setShowRefreshButton

Sets a new value for property showRefreshButton.

Set to true to display a refresh button in place of the search icon. By pressing the refresh button or F5 key on keyboard, the user can reload the results list without changing the search string.

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

New value for property showRefreshButton

setShowSearchButton

Sets a new value for property showSearchButton.

Set to true to show the search button with the magnifier icon. If false, both the search and refresh buttons are not displayed even if the "showRefreshButton" property is true.

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
bShowSearchButton boolean true

New value for property showSearchButton

setValue

Sets a new value for property value.

Input Value.

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

Param Type DefaultValue Description
sValue string

New value for property value

setVisible

Sets a new value for property visible.

Invisible inputs are not rendered.

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
bVisible boolean true

New value for property visible

setWidth

Sets a new value for property width.

Defines the CSS width of the input. If not set, width is 100%.

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

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

New value for property width

suggest

Toggle visibility of the suggestion list.

Param Type DefaultValue Description
bShow boolean true

If the value is true the suggestions are displayed. If the value is false the suggestions are hidden. An empty suggestion list is not shown on desktop and tablet devices.

This method may be called only as a response to the suggest event to ensure that the suggestion list is shown at the moment when the user expects it.

unbindValue

Unbinds property value from model data.