sap.m.SearchField.extend(sClassName, oClassInfo?, FNMetaImpl?): function
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.
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.m.SearchField.
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 suggestionItem to the aggregation suggestionItems
.
Parameters:
- Since:
- 1.34
Returns:
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 when the value of the search field is changed by a user - e.g. at each key press. Do not invalidate or re-render a focused search field, especially during the liveChange 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.SearchField itself |
- Since:
- 1.9.1
Returns:
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.
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.SearchField itself |
Returns:
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.
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.SearchField itself |
- Since:
- 1.34
Returns:
Binds property
value
to model data.
See ManagedObject.bindProperty for a detailed description of the possible properties of oBindingInfo
Parameters:
{object} | oBindingInfo | The binding information |
Returns:
Destroys all the suggestionItems in the aggregation suggestionItems
.
- Since:
- 1.34
Returns:
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.
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.9.1
Returns:
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.
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:
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.
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.34
Returns:
Fires event
liveChange
to attached listeners.
Expects the following event parameters:
newValue
of type string
Current search string.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
- Since:
- 1.9.1
Returns:
Fires event
search
to attached listeners.
Expects the following event parameters:
query
of type string
The search query string.suggestionItem
of type sap.m.SuggestionItem
Suggestion list item in case if the user has selected an item from the suggestions list.refreshButtonPressed
of type boolean
Indicates if the user pressed the refresh icon.clearButtonPressed
of type boolean
Indicates if the user pressed the clear icon.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Fires event
suggest
to attached listeners.
Expects the following event parameters:
suggestValue
of type string
Current search string of the search field.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
- Since:
- 1.34
Returns:
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:
getEnabled(): boolean
Gets current value of property
enabled
.
Boolean property to enable the control (default is true).
Default value is true
.
Returns:
{boolean} | Value of property enabled |
getEnableSuggestions(): boolean
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
.
- Since:
- 1.34
Returns:
{boolean} | Value of property enableSuggestions |
getMaxLength(): int
Gets current value of property
maxLength
.
Maximum number of characters. Value '0' means the feature is switched off.
Default value is 0
.
Returns:
{int} | Value of property maxLength |
getPlaceholder(): string
Gets current value of property
placeholder
.
Text shown when no value available. Default placeholder text is the word "Search" in the current local language (if supported) or in English.
Returns:
{string} | Value of property placeholder |
getPopupAnchorDomRef(): domRef
Function returns DOM element which acts as reference point for the opening suggestion menu
- Since:
- 1.34
Returns:
{domRef} | the DOM element at which to open the suggestion list |
getRefreshButtonTooltip(): string
Gets current value of property
refreshButtonTooltip
.
Tooltip text of the refresh button. If it is not set, the tooltip of the SearchField (if any) is displayed. Tooltips are not displayed on touch devices.
- Since:
- 1.16
Returns:
{string} | Value of property refreshButtonTooltip |
getShowRefreshButton(): boolean
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
.
- Since:
- 1.16
Returns:
{boolean} | Value of property showRefreshButton |
getShowSearchButton(): boolean
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
.
- Since:
- 1.23
Returns:
{boolean} | Value of property showSearchButton |
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 fieldtext
is displayed as normal suggestion texticon
description
- additional text may be used to visually display search item type or category
- Since:
- 1.34
Returns:
getValue(): string
Gets current value of property
value
.
Input Value.
Returns:
{string} | Value of property value |
getVisible(): boolean
Gets current value of property
visible
.
Invisible inputs are not rendered.
Default value is true
.
Returns:
{boolean} | Value of property visible |
Gets current value of property
width
.
Defines the CSS width of the input. If not set, width is 100%.
Returns:
indexOfSuggestionItem(oSuggestionItem): int
Checks for the provided sap.m.SuggestionItem
in the aggregation suggestionItems
. and returns its index if found or -1 otherwise.
Parameters:
- Since:
- 1.34
Returns:
{int} | The index of the provided control in the aggregation if found, or -1 otherwise |
Inserts a suggestionItem into the aggregation suggestionItems
.
Parameters:
{sap.m.SuggestionItem} | oSuggestionItem | the suggestionItem to insert; if empty, nothing is inserted |
{int} | iIndex | 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 |
- Since:
- 1.34
Returns:
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
suggestionItems
.
Additionally, it unregisters them from the hosting UIArea.
- Since:
- 1.34
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 suggestionItem from the aggregation suggestionItems
.
Parameters:
- Since:
- 1.34
Returns:
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
.
Parameters:
{boolean} | bEnabled | New value for property enabled |
Returns:
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
.
Parameters:
{boolean} | bEnableSuggestions | New value for property enableSuggestions |
- Since:
- 1.34
Returns:
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
.
Parameters:
{int} | iMaxLength | New value for property maxLength |
Returns:
Sets a new value for property
placeholder
.
Text shown when no value available. Default placeholder text is the word "Search" in the current local language (if supported) or in English.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
{string} | sPlaceholder | New value for property placeholder |
Returns:
Sets a new value for property
refreshButtonTooltip
.
Tooltip text of the refresh button. If it is not set, the tooltip of the SearchField (if any) is displayed. 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.
Parameters:
{string} | sRefreshButtonTooltip | New value for property refreshButtonTooltip |
- Since:
- 1.16
Returns:
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
.
Parameters:
{boolean} | bShowRefreshButton | New value for property showRefreshButton |
- Since:
- 1.16
Returns:
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
.
Parameters:
{boolean} | bShowSearchButton | New value for property showSearchButton |
- Since:
- 1.23
Returns:
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.
Parameters:
{string} | sValue | New value for property value |
Returns:
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
.
Parameters:
{boolean} | bVisible | New value for property visible |
Returns:
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.
Parameters:
Returns:
Toggle visibility of the suggestion list.
Parameters:
{boolean|undefined} | bShow | set to true to display suggestions and false to hide them. Default value is true . 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. |
- Since:
- 1.34
Returns:
Unbinds property value
from model data.
Returns:
getSelectOnFocus(): boolean
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
.
- Deprecated:
- Since version 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.
- Since:
- 1.20
Returns:
{boolean} | Value of property selectOnFocus |
getShowMagnifier(): boolean
Gets current value of property
showMagnifier
.
Set to false to hide the magnifier icon.
Default value is true
.
- Deprecated:
- Since version 1.16.0. This parameter is deprecated. Use "showSearchButton" instead.
Returns:
{boolean} | Value of property showMagnifier |
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
.
Parameters:
{boolean} | bSelectOnFocus | New value for property selectOnFocus |
- Deprecated:
- Since version 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.
- Since:
- 1.20
Returns:
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
.
Parameters:
{boolean} | bShowMagnifier | New value for property showMagnifier |
- Deprecated:
- Since version 1.16.0. This parameter is deprecated. Use "showSearchButton" instead.
Returns: