The sap.m.MenuButton control enables the user to show a hierarchical menu.
Event Summary
defaultAction(oControlEvent)Fired when the buttonMode is set to Split and the user presses the main button unless useDefaultActionOnly is set to false and another action from the menu has been selected previously. Method Summary
sap.m.MenuButton.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.m.MenuButton with name sClassName and enriches it with the information contained in oClassInfo. attachDefaultAction(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the defaultAction event of this sap.m.MenuButton. bindMenu(oBindingInfo)Binds aggregation menu to model data. destroyMenu()Destroys the menu in the aggregation menu. detachDefaultAction(fnFunction, oListener)Detaches event handler fnFunction from the defaultAction event of this sap.m.MenuButton. getEnabled()Gets current value of property enabled. getIcon()Gets current value of property icon. getMenu()Gets content of aggregation menu. getText()Gets current value of property text. getType()Gets current value of property type. getWidth()Gets current value of property width. init()Initializes the control. setActiveIcon(sActiveIcon)Sets a new value for property activeIcon. setEnabled(bEnabled)Sets a new value for property enabled. setMenu(oMenu)Sets the aggregated menu. setTooltip(vTooltip)Sets the tooltip for the MenuButton. setWidth(sWidth)Sets a new value for property width. unbindMenu()Unbinds aggregation menu from model data. addStyleClass,
allowTextSelection,
attachBrowserEvent,
attachValidateFieldGroup,
checkFieldGroupIds,
clone,
detachBrowserEvent,
detachValidateFieldGroup,
fireValidateFieldGroup,
getAccessibilityInfo,
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,
findElements,
fireEvent,
focus,
getCustomData,
getDependents,
getDomRef,
getElementBinding,
getFocusDomRef,
getFocusInfo,
getInterface,
getLayoutData,
getMetadata,
getTooltip,
getTooltip_AsString,
getTooltip_Text,
indexOfCustomData,
indexOfDependent,
insertCustomData,
insertDependent,
prop,
removeAllCustomData,
removeAllDependents,
removeCustomData,
removeDependent,
removeEventDelegate,
setLayoutData,
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.m.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
- Events
- defaultAction : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
In addition, all settings applicable to the base type sap.ui.core.Control 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 |
Event Detail
defaultAction(oControlEvent)
Fired when the buttonMode is set to Split and the user presses the main button unless useDefaultActionOnly is set to false and another action from the menu has been selected previously.
Parameters:
Method Detail
sap.m.MenuButton.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.m.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.core.Control.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.m.MenuButton.
Returns:
Attaches event handler
fnFunction to the
defaultAction event of this
sap.m.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.m.MenuButton itself.
Fired when the buttonMode is set to Split and the user presses the main button unless useDefaultActionOnly is set to false and another action from the menu has been selected previously.
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.m.MenuButton itself |
Returns:
Parameters:
| {object} | oBindingInfo | The binding information |
Returns:
Destroys the menu in the aggregation menu.
Returns:
Detaches event handler
fnFunction from the
defaultAction event of this
sap.m.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:
Fires event defaultAction to attached listeners.
Parameters:
| {Map} | mArguments? | The arguments to pass along with the event |
Returns:
Gets current value of property
activeIcon.
The source property of an alternative icon for the active (pressed) state of the button. Both active and default icon properties should be defined and of the same type - image or icon font. If the icon property is not set or has a different type, the active icon is not displayed.
Returns:
Gets current value of property
buttonMode.
Defines whether the MenuButton is set to Regular or Split mode.
Default value is Regular.
Returns:
getEnabled(): boolean
Gets current value of property
enabled.
Boolean property to enable the control (default is true).
Note: Depending on custom settings, the buttons that are disabled have other colors than the enabled ones.
Default value is true.
Returns:
| {boolean} | Value of property enabled |
Gets current value of property
icon.
Defines the icon to be displayed as a graphical element within the button. It can be an image or an icon from the icon font.
Returns:
getIconDensityAware(): boolean
Gets current value of property
iconDensityAware.
When set to true (default), one or more requests are sent trying to get the density perfect version of image if this version of image doesn't exist on the server. If only one version of image is provided, set this value to false to avoid the attempt of fetching density perfect image.
Default value is true.
Returns:
| {boolean} | Value of property iconDensityAware |
Gets content of aggregation
menu.
Defines the menu that opens for this button.
Returns:
getText(): string
Gets current value of property
text.
Defines the text of the MenuButton.
Note: In SplitbuttonMode with useDefaultActionOnly set to false, the text is changed to display the last selected item's text, while in RegularbuttonMode the text stays unchanged.
Returns:
| {string} | Value of property text |
Gets current value of property
textDirection.
Specifies the element's text directionality with enumerated options. By default, the control inherits text direction from the DOM.
Default value is Inherit.
Returns:
Gets current value of property
type.
Defines the type of the MenuButton (for example, Default, Accept, Reject, Back, etc.)
Default value is Default.
Returns:
getUseDefaultActionOnly(): Boolean
Gets current value of property
useDefaultActionOnly.
Controls whether the default action handler is invoked always or it is invoked only until a menu item is selected. Usable only if buttonMode is set to Split.
Default value is false.
Returns:
| {Boolean} | Value of property useDefaultActionOnly |
Gets current value of property
width.
Defines the width of the MenuButton.
Returns:
init()
Initializes the control.
Sets a new value for property
activeIcon.
The source property of an alternative icon for the active (pressed) state of the button. Both active and default icon properties should be defined and of the same type - image or icon font. If the icon property is not set or has a different type, the active icon is not displayed.
When called with a value of null or undefined, the default value of the property will be restored.
Parameters:
Returns:
setButtonMode(sMode): MenuButton
Sets the buttonМode of the control.
Parameters:
Returns:
| {MenuButton} | This instance |
Sets a new value for property
enabled.
Boolean property to enable the control (default is true).
Note: Depending on custom settings, the buttons that are disabled have other colors than the enabled ones.
When called with a value of null or undefined, the default value of the property will be restored.
Default value is true.
Parameters:
| {boolean} | bEnabled | New value for property enabled |
Returns:
Sets a new value for property
iconDensityAware.
When set to true (default), one or more requests are sent trying to get the density perfect version of image if this version of image doesn't exist on the server. If only one version of image is provided, set this value to false to avoid the attempt of fetching density perfect image.
When called with a value of null or undefined, the default value of the property will be restored.
Default value is true.
Parameters:
| {boolean} | bIconDensityAware | New value for property iconDensityAware |
Returns:
Sets the aggregated menu.
Parameters:
Returns:
Sets a new value for property
textDirection.
Specifies the element's text directionality with enumerated options. By default, the control inherits text direction from the DOM.
When called with a value of null or undefined, the default value of the property will be restored.
Default value is Inherit.
Parameters:
Returns:
setTooltip(vTooltip): *
Sets the tooltip for the MenuButton. Can either be an instance of a TooltipBase subclass or a simple string.
Parameters:
Returns:
Sets a new value for property
useDefaultActionOnly.
Controls whether the default action handler is invoked always or it is invoked only until a menu item is selected. Usable only if buttonMode is set to Split.
When called with a value of null or undefined, the default value of the property will be restored.
Default value is false.
Parameters:
| {Boolean} | sUseDefaultActionOnly | New value for property useDefaultActionOnly |
Returns:
Sets a new value for property
width.
Defines the width of the MenuButton.
When called with a value of null or undefined, the default value of the property will be restored.
Parameters:
Returns:
Unbinds aggregation menu from model data.
Returns: