Common button control that opens a menu when clicked by the user. The control provides an API for configuring the docking position of the menu.
Deprecated API:Since version 1.38. Instead, use the sap.m.MenuButton
control.
Event Summary
itemSelected(oControlEvent)Event that is fired when a menu item is selected by the user press(oControlEvent)Fired when an item from the menu was selected. Method Summary
sap.ui.commons.MenuButton.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.commons.MenuButton with name sClassName
and enriches it with the information contained in oClassInfo
. attachItemSelected(oData?, fnFunction, oListener?)Attaches event handler fnFunction
to the itemSelected
event of this sap.ui.commons.MenuButton
. attachPress(oData?, fnFunction, oListener?)Attach event-handler fnFunction
to the 'press' event of this sap.ui.commons.MenuButton
. destroyMenu()Destroys the menu in the aggregation named menu
. detachItemSelected(fnFunction, oListener)Detaches event handler fnFunction
from the itemSelected
event of this sap.ui.commons.MenuButton
. detachPress(fnFunction, oListener)Detach event-handler fnFunction
from the 'press' event of this sap.ui.commons.MenuButton
. firePress(mArguments?)Fire event press to attached listeners. getMenu()Gets content of aggregation menu
. setDockButton(sDockButton)Sets a new value for property dockButton
. setDockMenu(sDockMenu)Sets a new value for property dockMenu
. setMenu(oMenu)Setter for the aggregated menu
. addAriaDescribedBy,
addAriaLabelledBy,
focus,
getAccessibilityInfo,
getAriaDescribedBy,
getAriaLabelledBy,
getEnabled,
getHeight,
getHelpId,
getIcon,
getIconFirst,
getIconHovered,
getIconSelected,
getLite,
getStyle,
getStyled,
getText,
getWidth,
removeAllAriaDescribedBy,
removeAllAriaLabelledBy,
removeAriaDescribedBy,
removeAriaLabelledBy,
setEnabled,
setHeight,
setHelpId,
setIcon,
setIconFirst,
setIconHovered,
setIconSelected,
setLite,
setStyle,
setStyled,
setText,
setWidth addStyleClass,
allowTextSelection,
attachBrowserEvent,
attachValidateFieldGroup,
checkFieldGroupIds,
clone,
detachBrowserEvent,
detachValidateFieldGroup,
fireValidateFieldGroup,
getBusy,
getBusyIndicatorDelay,
getControlsByFieldGroupId,
getFieldGroupIds,
getIdForLabel,
getRenderer,
getVisible,
hasStyleClass,
invalidate,
isBusy,
onAfterRendering,
onBeforeRendering,
placeAt,
removeStyleClass,
rerender,
setBusy,
setBusyIndicatorDelay,
setFieldGroupIds,
setVisible,
toggleStyleClass,
triggerValidateFieldGroup $,
addCustomData,
addDependent,
addEventDelegate,
applyFocusInfo,
bindElement,
data,
destroy,
destroyCustomData,
destroyDependents,
destroyLayoutData,
destroyTooltip,
enhanceAccessibilityState,
exit,
findElements,
fireEvent,
getCustomData,
getDependents,
getDomRef,
getElementBinding,
getFocusDomRef,
getFocusInfo,
getInterface,
getLayoutData,
getMetadata,
getTooltip,
getTooltip_AsString,
getTooltip_Text,
indexOfCustomData,
indexOfDependent,
init,
insertCustomData,
insertDependent,
prop,
removeAllCustomData,
removeAllDependents,
removeCustomData,
removeDependent,
removeEventDelegate,
setLayoutData,
setTooltip,
toString,
unbindElement addAggregation,
addAssociation,
applySettings,
attachFormatError,
attachModelContextChange,
attachParseError,
attachValidationError,
attachValidationSuccess,
bindAggregation,
bindContext,
bindObject,
bindProperty,
destroyAggregation,
detachFormatError,
detachModelContextChange,
detachParseError,
detachValidationError,
detachValidationSuccess,
findAggregatedObjects,
fireFormatError,
fireModelContextChange,
fireParseError,
fireValidationError,
fireValidationSuccess,
getAggregation,
getAssociation,
getBinding,
getBindingContext,
getBindingInfo,
getBindingPath,
getEventingParent,
getId,
getModel,
getObjectBinding,
getOriginInfo,
getParent,
getProperty,
hasModel,
indexOfAggregation,
insertAggregation,
isBound,
isInvalidateSuppressed,
isTreeBinding,
propagateMessages,
removeAggregation,
removeAllAggregation,
removeAllAssociation,
removeAssociation,
setAggregation,
setAssociation,
setBindingContext,
setModel,
setProperty,
unbindAggregation,
unbindContext,
unbindObject,
unbindProperty,
validateAggregation,
validateProperty Constructor Detail
new sap.ui.commons.MenuButton(sId?, mSettings?)
Constructor for a new MenuButton.
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.
The supported settings are:
- Properties
- Aggregations
- menu : sap.ui.unified.Menu (default)
- Events
- itemSelected : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
In addition, all settings applicable to the base type sap.ui.commons.Button can be used as well.
Parameters:
{string} | sId? | id for the new control, generated automatically if no id is given |
{object} | mSettings? | initial settings for the new control |
- Deprecated:
- Since version 1.38. Instead, use the
sap.m.MenuButton
control.
Event Detail
itemSelected(oControlEvent)
Event that is fired when a menu item is selected by the user
Parameters:
press(oControlEvent)
Fired when an item from the menu was selected.
Parameters:
See:
sap.ui.commons.MenuButton#itemSelected |
Method Detail
sap.ui.commons.MenuButton.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.commons.MenuButton 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.Button.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.ui.commons.MenuButton.
Returns:
Attaches event handler
fnFunction
to the
itemSelected
event of this
sap.ui.commons.MenuButton
.
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.MenuButton
itself.
Event that is fired when a menu item is selected by the user
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.ui.commons.MenuButton itself |
Returns:
Attach event-handler
fnFunction
to the 'press' event of this
sap.ui.commons.MenuButton
.
Event is fired when an item from the menu was selected.
Parameters:
{object} | oData? | The object, that should be passed along with the event-object when firing the event. |
{function} | fnFunction | The function to call, when the event occurs. This function will be called on the oListener-instance (if present) or in a 'static way'. |
{object} | oListener? | Object on which to call the given function. If empty, the global context (window) is used. |
Returns:
See:
Destroys the menu in the aggregation named menu
.
Returns:
Detaches event handler
fnFunction
from the
itemSelected
event of this
sap.ui.commons.MenuButton
.
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:
Detach event-handler
fnFunction
from the 'press' event of this
sap.ui.commons.MenuButton
.
The passed function and listener object must match the ones previously used for event registration.
Parameters:
{function} | fnFunction | The function to call, when the event occurs. |
{object} | oListener | Object on which the given function had to be called. |
Returns:
See:
Fires event
itemSelected
to attached listeners.
Expects the following event parameters:
itemId
of type string
The ID of the selected itemitem
of type sap.ui.unified.MenuItemBase
The selected item
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Fire event press to attached listeners.
Parameters:
{Map} | mArguments? | the arguments to pass along with the event. |
Returns:
See:
getDockButton(): string
Gets current value of property
dockButton
.
The position / edge (see sap.ui.core.Popup.Dock) of the button where the menu is docked. Default is 'begin bottom'.
Returns:
{string} | Value of property dockButton |
getDockMenu(): string
Gets current value of property
dockMenu
.
The position / edge (see sap.ui.core.Popup.Dock) of the menu which is docked to the button. Default is 'begin top'.
Returns:
{string} | Value of property dockMenu |
Gets content of aggregation
menu
.
Menu that shall be opened when the button is clicked
Returns:
Sets a new value for property
dockButton
.
The position / edge (see sap.ui.core.Popup.Dock) of the button where the menu is docked. Default is 'begin bottom'.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
{string} | sDockButton | New value for property dockButton |
Returns:
Sets a new value for property
dockMenu
.
The position / edge (see sap.ui.core.Popup.Dock) of the menu which is docked to the button. Default is 'begin top'.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
{string} | sDockMenu | New value for property dockMenu |
Returns:
Setter for the aggregated menu
.
Parameters:
Returns: