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 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 |
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 |
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 |
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. |
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). |
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
|
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 |
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 |
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 Default value is |
setText |
Sets a new value for property text. Defines the text which should be displayed on the item. When called with a value of Default value is |
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 |
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 |
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
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
.
Gets current value of property text.
Defines the text which should be displayed on the item.
Default value is empty string
.
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 |
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 |
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 |