class sap.ui.commons.AutoComplete

Visiblity: public
UX Guidelines:
Implements: sap.ui.commons.ToolbarItem
Available since: N/A
Module: sap/ui/commons/AutoComplete
Application Component: CA-UI5-CTR

Textfield with list based text completion.


Constructor

Constructor for a new AutoComplete.

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.ui.commons.AutoComplete(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
enableScrolling boolean true

Determines whether scrolling should be enabled when the number of items is higher than maxPopupItems. If set to false only the first n items (n=maxPopupItems) are shown.

Visibility: public

Borrowed Properties

Name Type Default Value Description
displaySecondaryValues boolean false

Indicates whether the additionalText property that is available for sap.ui.core.ListItem shall be displayed in the list.

Visibility: public
maxPopupItems int 10

Defines the number of items that shall be displayed at once. If the overall number of items is higher than this setting, a scrollbar is provided.

Visibility: public
selectedItemId string

Id of the selected item. If the value has no corresponding item, the selectedItemId is empty.

If the selectedItemId is set to a not existing item, it will not be changed.

Visibility: public
selectedKey string

Key of the selected item.

If the value has no corresponding item the key is empty.

If duplicate keys exists the first item matching the key is used.

If the key is set to a not existing value it will not be changed.

Visibility: public
accessibleRole sap.ui.core.AccessibleRole Textbox

Accessibility role for the text field.

Visibility: public
design sap.ui.core.Design Standard

Font type. valid values are Standard and Monospace.

Visibility: public
editable boolean true

Switches edit state of the control. Read-only fields have different colors, depending on theme setting.

Visibility: public
enabled boolean true

Switches enabled state of the control. Disabled fields have different colors, and can not be focused.

Visibility: public
helpId string empty string

Unique identifier used for help service.

Visibility: public
imeMode sap.ui.core.ImeMode Auto

State of the Input Method Editor (IME).

Visibility: public
maxLength int 0

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

Visibility: public
name string

The name property to be used in the HTML code (e.g. for HTML forms that send data to the server via 'submit').

Visibility: public
placeholder string

Placeholder for the text field.

Since: 1.14.0.

Visibility: public
required boolean false

Depending on theme the TextField is shown as required. If a Label is assigned to the TextField it will visualize the requires state too.

Visibility: public
textAlign sap.ui.core.TextAlign Begin

Sets the horizontal alignment of the text.

Visibility: public
textDirection sap.ui.core.TextDirection Inherit

Direction of the text. Possible values: "rtl", "ltr".

Visibility: public
value string empty string

Text inside the TextField

Visibility: public
valueState sap.ui.core.ValueState None

Visualizes warnings or errors related to the text field. Possible values: Warning, Error, Success.

Visibility: public
width sap.ui.core.CSSSize

Width of text field. When it is set (CSS-size such as % or px), this is the exact size. When left blank, the text field length defines the width.

Visibility: public

Borrowed Aggregations

Name Cardinality Type Description
items 0..n sap.ui.core.ListItem

ListItems (see sap.ui.core.ListBox) that shall be displayed in the list.


Events Overview

Event Description
suggest

Fired when the user has changed the value and a suggestion list update should occur.

suggest

Fired when the user has changed the value and a suggestion list update should occur.

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

The current value which was typed in.


Methods Overview

Method Description
attachSuggest

Attaches event handler fnFunction to the suggest event of this sap.ui.commons.AutoComplete.

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.ui.commons.AutoComplete itself.

Fired when the user has changed the value and a suggestion list update should occur.

detachSuggest

Detaches event handler fnFunction from the suggest event of this sap.ui.commons.AutoComplete.

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

sap.ui.commons.AutoComplete.extend

Creates a new subclass of class sap.ui.commons.AutoComplete 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.commons.ComboBox.extend.

fireSuggest

Fires event suggest to attached listeners.

getEnableScrolling

Gets current value of property enableScrolling.

Determines whether scrolling should be enabled when the number of items is higher than maxPopupItems. If set to false only the first n items (n=maxPopupItems) are shown.

Default value is true.

getListBox
Since 1.10.0 NOT SUPPORTED
sap.ui.commons.AutoComplete.getMetadata

Returns a metadata object for class sap.ui.commons.AutoComplete.

getSelectedItemId
Since 1.10.0 NOT SUPPORTED
getSelectedKey
Since 1.10.0 NOT SUPPORTED
setEnableScrolling

Sets a new value for property enableScrolling.

Determines whether scrolling should be enabled when the number of items is higher than maxPopupItems. If set to false only the first n items (n=maxPopupItems) are shown.

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

Default value is true.

setFilterFunction

Sets a custom filter function for items. Default is to check whether the item text begins with the typed value.

Example: function(sValue, oItem){ return jQuery.sap.startsWithIgnoreCase(oItem.getText(), sValue); }

setListBox
Since 1.10.0 NOT SUPPORTED
setSelectedItemId
Since 1.10.0 NOT SUPPORTED
setSelectedKey
Since 1.10.0 NOT SUPPORTED

attachSuggest

Attaches event handler fnFunction to the suggest event of this sap.ui.commons.AutoComplete.

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.ui.commons.AutoComplete itself.

Fired when the user has changed the value and a suggestion list update should occur.

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.ui.commons.AutoComplete itself

detachSuggest

Detaches event handler fnFunction from the suggest event of this sap.ui.commons.AutoComplete.

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.ui.commons.AutoComplete.extend

Creates a new subclass of class sap.ui.commons.AutoComplete 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.commons.ComboBox.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

fireSuggest

Fires event suggest to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

suggestValue string

The current value which was typed in.

getEnableScrolling

Gets current value of property enableScrolling.

Determines whether scrolling should be enabled when the number of items is higher than maxPopupItems. If set to false only the first n items (n=maxPopupItems) are shown.

Default value is true.

getListBox

Since 1.10.0 NOT SUPPORTED

sap.ui.commons.AutoComplete.getMetadata

Returns a metadata object for class sap.ui.commons.AutoComplete.

getSelectedItemId

Since 1.10.0 NOT SUPPORTED

getSelectedKey

Since 1.10.0 NOT SUPPORTED

setEnableScrolling

Sets a new value for property enableScrolling.

Determines whether scrolling should be enabled when the number of items is higher than maxPopupItems. If set to false only the first n items (n=maxPopupItems) are shown.

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

New value for property enableScrolling

setFilterFunction

Sets a custom filter function for items. Default is to check whether the item text begins with the typed value.

Example: function(sValue, oItem){ return jQuery.sap.startsWithIgnoreCase(oItem.getText(), sValue); }

Param Type DefaultValue Description
fFilter function

The filter function. If not set the default filter function will be used.

setListBox

Since 1.10.0 NOT SUPPORTED
Param Type DefaultValue Description
oListBox string sap.ui.commons.ListBox

setSelectedItemId

Since 1.10.0 NOT SUPPORTED
Param Type DefaultValue Description
sSelectedItemId string

setSelectedKey

Since 1.10.0 NOT SUPPORTED
Param Type DefaultValue Description
sSelectedKey string