class sap.ui.commons.DropdownBox

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

The control provides a field that allows end users to an entry out of a list of pre-defined items. The choosable items can be provided in the form of a complete ListBox, single ListItems.


Constructor

Constructor for a new DropdownBox.

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.DropdownBox(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
maxHistoryItems int 0

Maximum number of history items in the list.

If 0 no history is displayed or stored. The history is locally stored on the client. Therefore do not activate this feature when this control handles confidential data.

Visibility: public
searchHelpAdditionalText string

(optional) The additional Text to use for the search help entry.

Visibility: public
searchHelpEnabled boolean false

Whether the DropdownBox's search help should be enabled.

Visibility: public
searchHelpIcon sap.ui.core.URI

(optional) The URI of the icon to use for the search help entry.

Visibility: public
searchHelpText string

(optional) The text to use for the search help entry.

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
searchHelp

Event fired whenever the configured searchHelpItem is clicked or the searchHelpItem is configured and F4 key is pressed.

searchHelp

Event fired whenever the configured searchHelpItem is clicked or the searchHelpItem is configured and F4 key is pressed.

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

The current value of the DropdownBox.


Methods Overview

Method Description
attachSearchHelp

Attaches event handler fnFunction to the searchHelp event of this sap.ui.commons.DropdownBox.

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

Event fired whenever the configured searchHelpItem is clicked or the searchHelpItem is configured and F4 key is pressed.

clearHistory

Using this method the history of the DropdownBox can be cleared. This might be necessary if the items of the DropdownBox have changed. Otherwise invalid items may appear in the history.

detachSearchHelp

Detaches event handler fnFunction from the searchHelp event of this sap.ui.commons.DropdownBox.

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

sap.ui.commons.DropdownBox.extend

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

fireSearchHelp

Fires event searchHelp to attached listeners.

getMaxHistoryItems

Gets current value of property maxHistoryItems.

Maximum number of history items in the list.

If 0 no history is displayed or stored. The history is locally stored on the client. Therefore do not activate this feature when this control handles confidential data.

Default value is 0.

sap.ui.commons.DropdownBox.getMetadata

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

getSearchHelpAdditionalText

Gets current value of property searchHelpAdditionalText.

(optional) The additional Text to use for the search help entry.

getSearchHelpEnabled

Gets current value of property searchHelpEnabled.

Whether the DropdownBox's search help should be enabled.

Default value is false.

getSearchHelpIcon

Gets current value of property searchHelpIcon.

(optional) The URI of the icon to use for the search help entry.

getSearchHelpText

Gets current value of property searchHelpText.

(optional) The text to use for the search help entry.

getTooltip_AsString

Extends the method inherited from sap.ui.core.Element by providing information on Search Help access (if needed)

onAfterRendering

Ensure that handed in ListBoxes are taken from the visible UI immediately.

onclick

Handle the click event happening in the DropdownBox

onfocusin

Handle focusin event Ensures the text gets selected when focus gets into the field

onkeydown

Handle keydown event

onkeypress

Handle keypress event

onkeyup

Handle keyup event This must only be considered if it is from Backspace-key in IE or after paste. In case there is a keyup with a tab this results from being entered via tabbing and can be ignored, too.

onpaste

Handle paste event

onsapdelete

Handle pseudo event onsapdelete. If triggered with open dropdown and current item provided by history feature, removes the selected item from this instance's history.

onsaphome

Handle pseudo event onsaphome

onsapleft

Move the cursor one step to the left (and adapt selection)

onsapright

Move the cursor one step to the right (and adapt selection)

onsapshow

Handle sapshow pseudo events on the control

onselect

Handle the select event happening in the DropdownBox

setMaxHistoryItems

Sets a new value for property maxHistoryItems.

Maximum number of history items in the list.

If 0 no history is displayed or stored. The history is locally stored on the client. Therefore do not activate this feature when this control handles confidential data.

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

Default value is 0.

setSearchHelpAdditionalText

Overwrite of Setter for property searchHelpAdditionalText.

Default value is empty/undefined

setSearchHelpEnabled

Overwrite of Setter for property searchHelpEnabled. This method accepts additional parameter to be compatiple with the previous functionality

Default value is false

setSearchHelpIcon

Overwrite of Setter for property searchHelpIcon.

Default value is empty/undefined

setSearchHelpText

Overwrite of Setter for property searchHelpText.

Default value is empty/undefined

attachSearchHelp

Attaches event handler fnFunction to the searchHelp event of this sap.ui.commons.DropdownBox.

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

Event fired whenever the configured searchHelpItem is clicked or the searchHelpItem is configured and F4 key is pressed.

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

clearHistory

Using this method the history of the DropdownBox can be cleared. This might be necessary if the items of the DropdownBox have changed. Otherwise invalid items may appear in the history.

detachSearchHelp

Detaches event handler fnFunction from the searchHelp event of this sap.ui.commons.DropdownBox.

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.DropdownBox.extend

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

fireSearchHelp

Fires event searchHelp to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

value string

The current value of the DropdownBox.

getMaxHistoryItems

Gets current value of property maxHistoryItems.

Maximum number of history items in the list.

If 0 no history is displayed or stored. The history is locally stored on the client. Therefore do not activate this feature when this control handles confidential data.

Default value is 0.

sap.ui.commons.DropdownBox.getMetadata

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

getSearchHelpAdditionalText

Gets current value of property searchHelpAdditionalText.

(optional) The additional Text to use for the search help entry.

getSearchHelpEnabled

Gets current value of property searchHelpEnabled.

Whether the DropdownBox's search help should be enabled.

Default value is false.

getSearchHelpIcon

Gets current value of property searchHelpIcon.

(optional) The URI of the icon to use for the search help entry.

getSearchHelpText

Gets current value of property searchHelpText.

(optional) The text to use for the search help entry.

getTooltip_AsString

Extends the method inherited from sap.ui.core.Element by providing information on Search Help access (if needed)

onAfterRendering

Ensure that handed in ListBoxes are taken from the visible UI immediately.

Param Type DefaultValue Description
oEvent jQuery.Event

The event object.

onclick

Handle the click event happening in the DropdownBox

Param Type DefaultValue Description
oEvent jQuery.Event

The event object.

onfocusin

Handle focusin event Ensures the text gets selected when focus gets into the field

Param Type DefaultValue Description
oEvent jQuery.Event

the occuring event

onkeydown

Handle keydown event

Param Type DefaultValue Description
oEvent jQuery.Event

the occuring event

onkeypress

Handle keypress event

Param Type DefaultValue Description
oEvent jQuery.Event

the occuring event

onkeyup

Handle keyup event This must only be considered if it is from Backspace-key in IE or after paste. In case there is a keyup with a tab this results from being entered via tabbing and can be ignored, too.

Param Type DefaultValue Description
oEvent jQuery.Event

the occuring event

onpaste

Handle paste event

Param Type DefaultValue Description
oEvent jQuery.Event

the occuring event

onsapdelete

Handle pseudo event onsapdelete. If triggered with open dropdown and current item provided by history feature, removes the selected item from this instance's history.

Param Type DefaultValue Description
oEvent jQuery.Event

the occuring event

onsaphome

Handle pseudo event onsaphome

Param Type DefaultValue Description
oEvent jQuery.Event

the occuring event

onsapleft

Move the cursor one step to the left (and adapt selection)

Param Type DefaultValue Description
oEvent jQuery.Event

The event object.

onsapright

Move the cursor one step to the right (and adapt selection)

Param Type DefaultValue Description
oEvent jQuery.Event

The event object.

onsapshow

Handle sapshow pseudo events on the control

Param Type DefaultValue Description
oEvent jQuery.Event

The event object.

onselect

Handle the select event happening in the DropdownBox

Param Type DefaultValue Description
oEvent jQuery.Event

The event object.

setMaxHistoryItems

Sets a new value for property maxHistoryItems.

Maximum number of history items in the list.

If 0 no history is displayed or stored. The history is locally stored on the client. Therefore do not activate this feature when this control handles confidential data.

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
iMaxHistoryItems int 0

New value for property maxHistoryItems

setSearchHelpAdditionalText

Overwrite of Setter for property searchHelpAdditionalText.

Default value is empty/undefined

Param Type DefaultValue Description
sSearchHelpAdditionalText string

new value for property searchHelpAdditionalText

setSearchHelpEnabled

Overwrite of Setter for property searchHelpEnabled. This method accepts additional parameter to be compatiple with the previous functionality

Default value is false

Param Type DefaultValue Description
bEnabled boolean

new value for property searchHelpEnabled

sText string

new value for property searchHelpText

sAdditionalText string

new value for property searchHelpAdditionalText

sIcon string

new value for property searchHelpIcon

setSearchHelpIcon

Overwrite of Setter for property searchHelpIcon.

Default value is empty/undefined

Param Type DefaultValue Description
sSearchHelpIcon sap.ui.core.URI

new value for property searchHelpIcon

setSearchHelpText

Overwrite of Setter for property searchHelpText.

Default value is empty/undefined

Param Type DefaultValue Description
sSearchHelpText string

new value for property searchHelpText