Textfield with list based text completion.
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 |
Name | Type | Default Value | Description |
---|---|---|---|
displaySecondaryValues | boolean | false | Indicates whether the |
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 If the |
|
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 |
|
placeholder | string | Placeholder for the text field. |
|
required | boolean | false | Depending on theme the |
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 |
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 |
Name | Cardinality | Type | Description |
---|---|---|---|
items | 0..n | sap.ui.core.ListItem |
|
Event | Description |
---|---|
suggest |
Fired when the user has changed the value and a suggestion list update should occur. |
Method | Description |
---|---|
attachSuggest |
Attaches event handler When called, the context of the event handler (its Fired when the user has changed the value and a suggestion list update should occur. |
detachSuggest |
Detaches event handler 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
|
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 |
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 Default value is |
setFilterFunction |
Sets a custom filter function for items. Default is to check whether the item text begins with the typed value. Example: |
setListBox |
Since 1.10.0 NOT SUPPORTED
|
setSelectedItemId |
Since 1.10.0 NOT SUPPORTED
|
setSelectedKey |
Since 1.10.0 NOT SUPPORTED
|
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 |
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 |
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 |
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. |
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
.
Returns a metadata object for class sap.ui.commons.AutoComplete.
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 |
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. |
Param | Type | DefaultValue | Description |
---|---|---|---|
oListBox | string sap.ui.commons.ListBox |