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 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 |
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 |
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 |
---|---|
searchHelp |
Event fired whenever the configured searchHelpItem is clicked or the searchHelpItem is configured and F4 key is pressed. |
Method | Description |
---|---|
attachSearchHelp |
Attaches event handler When called, the context of the event handler (its 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 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
|
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 |
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 |
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 Default value is |
setSearchHelpAdditionalText |
Overwrite of Setter for property Default value is empty/ |
setSearchHelpEnabled |
Overwrite of Setter for property Default value is |
setSearchHelpIcon |
Overwrite of Setter for property Default value is empty/ |
setSearchHelpText |
Overwrite of Setter for property Default value is empty/ |
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 |
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.
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 |
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 |
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. |
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
.
Returns a metadata object for class sap.ui.commons.DropdownBox.
Gets current value of property searchHelpAdditionalText.
(optional) The additional Text to use for the search help entry.
Gets current value of property searchHelpEnabled.
Whether the DropdownBox's search help should be enabled.
Default value is false
.
Gets current value of property searchHelpIcon.
(optional) The URI of the icon to use for the search help entry.
Gets current value of property searchHelpText.
(optional) The text to use for the search help entry.
Extends the method inherited from sap.ui.core.Element by providing information on Search Help access (if needed)
Ensure that handed in ListBoxes are taken from the visible UI immediately.
Param | Type | DefaultValue | Description |
---|---|---|---|
oEvent | jQuery.Event |
The event object. |
Handle the click event happening in the DropdownBox
Param | Type | DefaultValue | Description |
---|---|---|---|
oEvent | jQuery.Event |
The event object. |
Handle focusin event Ensures the text gets selected when focus gets into the field
Param | Type | DefaultValue | Description |
---|---|---|---|
oEvent | jQuery.Event |
the occuring event |
Handle keydown event
Param | Type | DefaultValue | Description |
---|---|---|---|
oEvent | jQuery.Event |
the occuring event |
Handle keypress event
Param | Type | DefaultValue | Description |
---|---|---|---|
oEvent | jQuery.Event |
the occuring event |
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 |
Handle paste event
Param | Type | DefaultValue | Description |
---|---|---|---|
oEvent | jQuery.Event |
the occuring event |
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 |
Handle pseudo event onsaphome
Param | Type | DefaultValue | Description |
---|---|---|---|
oEvent | jQuery.Event |
the occuring event |
Move the cursor one step to the left (and adapt selection)
Param | Type | DefaultValue | Description |
---|---|---|---|
oEvent | jQuery.Event |
The event object. |
Move the cursor one step to the right (and adapt selection)
Param | Type | DefaultValue | Description |
---|---|---|---|
oEvent | jQuery.Event |
The event object. |
Handle sapshow pseudo events on the control
Param | Type | DefaultValue | Description |
---|---|---|---|
oEvent | jQuery.Event |
The event object. |
Handle the select event happening in the DropdownBox
Param | Type | DefaultValue | Description |
---|---|---|---|
oEvent | jQuery.Event |
The event object. |
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 |
Overwrite of Setter for property searchHelpAdditionalText
.
Default value is empty/undefined
Param | Type | DefaultValue | Description |
---|---|---|---|
sSearchHelpAdditionalText | string |
new value for property |
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 |
|
sText | string |
new value for property |
|
sAdditionalText | string |
new value for property |
|
sIcon | string |
new value for property |
Overwrite of Setter for property searchHelpIcon
.
Default value is empty/undefined
Param | Type | DefaultValue | Description |
---|---|---|---|
sSearchHelpIcon | sap.ui.core.URI |
new value for property |