class sap.ui.unified.MenuItem

Control sample: sap.ui.unified.MenuItem
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/unified/MenuItem
Application Component: CA-UI5-CTR

Standard item to be used inside a menu. A menu item represents an action which can be selected by the user in the menu or it can provide a submenu to organize the actions hierarchically.


Constructor

Constructor for a new MenuItem element.

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.unified.MenuItem(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
icon sap.ui.core.URI empty string

Defines the icon of the sap.ui.core.IconPool or an image which should be displayed on the item.

Visibility: public
text string empty string

Defines the text which should be displayed on the item.

Visibility: public

Borrowed Properties

Name Type Default Value Description
enabled boolean true

When an item is disabled the item can not be selected by the user. The enabled property of the item has no effect when the menu of the item is disabled (Menu#getEnabled).

Visibility: public
startsSection boolean false

Defines whether a visual separator should be rendered before the item. Note: If an item is invisible also the separator of this item is not shown.

Visibility: public
visible boolean true

Invisible items do not appear in the menu.

Visibility: public

Borrowed Aggregations

Name Cardinality Type Description
submenu 0..1 sap.ui.unified.Menu

An optional submenu of the item which is opened when the item is selected by the user.


Associations

Name Cardinality Type Description
ariaLabelledBy 0..n sap.ui.core.Control

Association to controls / IDs which label this control (see WAI-ARIA attribute aria-labelledby).


Methods Overview

Method Description
addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

sap.ui.unified.MenuItem.extend

Creates a new subclass of class sap.ui.unified.MenuItem 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.unified.MenuItemBase.extend.

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getIcon

Gets current value of property icon.

Defines the icon of the sap.ui.core.IconPool or an image which should be displayed on the item.

Default value is empty string.

sap.ui.unified.MenuItem.getMetadata

Returns a metadata object for class sap.ui.unified.MenuItem.

getText

Gets current value of property text.

Defines the text which should be displayed on the item.

Default value is empty string.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

setIcon

Sets a new value for property icon.

Defines the icon of the sap.ui.core.IconPool or an image which should be displayed on the item.

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

Default value is empty string.

setText

Sets a new value for property text.

Defines the text which should be displayed on the item.

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

Default value is empty string.

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to add; if empty, nothing is inserted

sap.ui.unified.MenuItem.extend

Creates a new subclass of class sap.ui.unified.MenuItem 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.unified.MenuItemBase.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

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getIcon

Gets current value of property icon.

Defines the icon of the sap.ui.core.IconPool or an image which should be displayed on the item.

Default value is empty string.

sap.ui.unified.MenuItem.getMetadata

Returns a metadata object for class sap.ui.unified.MenuItem.

getText

Gets current value of property text.

Defines the text which should be displayed on the item.

Default value is empty string.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy int sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to be removed or its index or ID

setIcon

Sets a new value for property icon.

Defines the icon of the sap.ui.core.IconPool or an image which should be displayed on the item.

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

Default value is empty string.

Param Type DefaultValue Description
sIcon sap.ui.core.URI ''

New value for property icon

setText

Sets a new value for property text.

Defines the text which should be displayed on the item.

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

Default value is empty string.

Param Type DefaultValue Description
sText string ''

New value for property text