class sap.m.MessageView

Control sample: sap.m.MessageView
Visiblity: public
UX Guidelines: Message View
Implements:
Available since: N/A
Module: sap/m/MessageView
Application Component: CA-UI5-CTR

It is used to display a summarized list of different types of messages (error, warning, success, and information messages).

Overview

It is meant to be embedded into container controls (such as sap.m.Popover, sap.m.ResponsivePopover, sap.m.Dialog). It provides a handy and systematized way to navigate and explore details for every message. If the MessageView contains only one item, which has either description, markupDescription or longTextUrl, its details page will be displayed initially. It also exposes the sap.m.MessageView#event:activeTitlePress event, which can be used for navigation from a message to its source.

Notes:

Structure

The MessageView stores all messages in an association of type sap.m.MessageItem, named items.
A set of properties determines how the items are rendered:

Usage

When to use:

Responsive Behavior

The responsiveness of the MessageView is determined by the container in which it is embedded. For that reason the control could not be visualized if the container’s sizes are not defined.


Constructor

Constructor for a new MessageView

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.m.MessageView(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
asyncDescriptionHandler any

Callback function for resolving a promise after description has been asynchronously loaded inside this function.

Visibility: public
asyncURLHandler any

Callback function for resolving a promise after a link has been asynchronously validated inside this function.

Visibility: public
groupItems boolean false

Defines whether the MessageItems are grouped or not.

Visibility: public
showDetailsPageHeader boolean true

Defines whether the header of details page will be shown.

Visibility: public

Aggregations

Default Aggregation: items

Name Cardinality Type Description
_navContainer 0..1 sap.m.NavContainer

A navContainer that contains both details and list pages.

headerButton 0..1 sap.m.Button

Sets a custom header button.

items (default) 0..n sap.m.MessageItem

A list with message items. If only one item is provided, the initial page will be the details page for the item.


Events Overview

Event Description
activeTitlePress

Event fired when an activeTitle of a MessageItem is pressed.

Since: 1.58.

afterOpen

Event fired after the popover is opened.

itemSelect

Event fired when description is shown.

listSelect

Event fired when one of the lists is shown when (not) filtered by type.

longtextLoaded

Event fired when the long text description data from a remote URL is loaded.

urlValidated

Event fired when a validation of a URL from long text description is ready.

activeTitlePress

Event fired when an activeTitle of a MessageItem is pressed.

Since: 1.58.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
item sap.m.MessageItem

Refers to the message item that contains the activeTitle.

afterOpen

Event fired after the popover is opened.

Use the appropriate event from the wrapper control, instead.
Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
openBy sap.ui.core.Control

This refers to the control which opens the popover.

itemSelect

Event fired when description is shown.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
item sap.m.MessageItem

Refers to the message item that is being presented.

messageTypeFilter sap.ui.core.MessageType

Refers to the type of messages being shown. See sap.ui.core.MessageType values for types.

listSelect

Event fired when one of the lists is shown when (not) filtered by type.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
messageTypeFilter sap.ui.core.MessageType

This parameter refers to the type of messages being shown.

longtextLoaded

Event fired when the long text description data from a remote URL is loaded.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

urlValidated

Event fired when a validation of a URL from long text description is ready.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

Methods Overview

Method Description
_makeAutomaticBinding

If there's no items binding, attach the MessageView to the sap.ui.getCore().getMessageManager().getMessageModel()

addItem

Adds some item to the aggregation items.

attachActiveTitlePress

Attaches event handler fnFunction to the activeTitlePress event of this sap.m.MessageView.

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.MessageView itself.

Event fired when an activeTitle of a MessageItem is pressed.

attachAfterOpen

Attaches event handler fnFunction to the afterOpen event of this sap.m.MessageView.

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.MessageView itself.

Event fired after the popover is opened.

Since 1.72 Use the appropriate event from the wrapper control, instead.
attachItemSelect

Attaches event handler fnFunction to the itemSelect event of this sap.m.MessageView.

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.MessageView itself.

Event fired when description is shown.

attachListSelect

Attaches event handler fnFunction to the listSelect event of this sap.m.MessageView.

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.MessageView itself.

Event fired when one of the lists is shown when (not) filtered by type.

attachLongtextLoaded

Attaches event handler fnFunction to the longtextLoaded event of this sap.m.MessageView.

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.MessageView itself.

Event fired when the long text description data from a remote URL is loaded.

attachUrlValidated

Attaches event handler fnFunction to the urlValidated event of this sap.m.MessageView.

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.MessageView itself.

Event fired when a validation of a URL from long text description is ready.

destroyHeaderButton

Destroys the headerButton in the aggregation headerButton.

destroyItems

Destroys all the items in the aggregation items.

detachActiveTitlePress

Detaches event handler fnFunction from the activeTitlePress event of this sap.m.MessageView.

The passed function and listener object must match the ones used for event registration.

detachAfterOpen

Detaches event handler fnFunction from the afterOpen event of this sap.m.MessageView.

The passed function and listener object must match the ones used for event registration.

Since 1.72 Use the appropriate event from the wrapper control, instead.
detachItemSelect

Detaches event handler fnFunction from the itemSelect event of this sap.m.MessageView.

The passed function and listener object must match the ones used for event registration.

detachListSelect

Detaches event handler fnFunction from the listSelect event of this sap.m.MessageView.

The passed function and listener object must match the ones used for event registration.

detachLongtextLoaded

Detaches event handler fnFunction from the longtextLoaded event of this sap.m.MessageView.

The passed function and listener object must match the ones used for event registration.

detachUrlValidated

Detaches event handler fnFunction from the urlValidated event of this sap.m.MessageView.

The passed function and listener object must match the ones used for event registration.

sap.m.MessageView.extend

Creates a new subclass of class sap.m.MessageView 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.

fireActiveTitlePress

Fires event activeTitlePress to attached listeners.

fireAfterOpen

Fires event afterOpen to attached listeners.

Since 1.72 Use the appropriate event from the wrapper control, instead.
fireItemSelect

Fires event itemSelect to attached listeners.

fireListSelect

Fires event listSelect to attached listeners.

fireLongtextLoaded

Fires event longtextLoaded to attached listeners.

fireUrlValidated

Fires event urlValidated to attached listeners.

getAsyncDescriptionHandler

Gets current value of property asyncDescriptionHandler.

Callback function for resolving a promise after description has been asynchronously loaded inside this function.

getAsyncURLHandler

Gets current value of property asyncURLHandler.

Callback function for resolving a promise after a link has been asynchronously validated inside this function.

getGroupItems

Gets current value of property groupItems.

Defines whether the MessageItems are grouped or not.

Default value is false.

getHeaderButton

Gets content of aggregation headerButton.

Sets a custom header button.

getItems

Gets content of aggregation items.

A list with message items. If only one item is provided, the initial page will be the details page for the item.

sap.m.MessageView.getMetadata

Returns a metadata object for class sap.m.MessageView.

getShowDetailsPageHeader

Gets current value of property showDetailsPageHeader.

Defines whether the header of details page will be shown.

Default value is true.

indexOfItem

Checks for the provided sap.m.MessageItem in the aggregation items. and returns its index if found or -1 otherwise.

insertItem

Inserts a item into the aggregation items.

navigateBack

Navigates back to the list page

removeAllItems

Removes all the controls from the aggregation items.

Additionally, it unregisters them from the hosting UIArea.

removeItem

Removes a item from the aggregation items.

setAsyncDescriptionHandler

Sets a new value for property asyncDescriptionHandler.

Callback function for resolving a promise after description has been asynchronously loaded inside this function.

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

setAsyncURLHandler

Sets a new value for property asyncURLHandler.

Callback function for resolving a promise after a link has been asynchronously validated inside this function.

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

sap.m.MessageView.setDefaultHandlers

Setter for default description and URL validation callbacks across all instances of MessageView

setGroupItems

Sets a new value for property groupItems.

Defines whether the MessageItems are grouped or not.

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

Default value is false.

setHeaderButton

Sets the aggregated headerButton.

setShowDetailsPageHeader

Sets a new value for property showDetailsPageHeader.

Defines whether the header of details page will be shown.

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

Default value is true.

_makeAutomaticBinding

If there's no items binding, attach the MessageView to the sap.ui.getCore().getMessageManager().getMessageModel()

addItem

Adds some item to the aggregation items.

Param Type DefaultValue Description
oItem sap.m.MessageItem

The item to add; if empty, nothing is inserted

attachActiveTitlePress

Attaches event handler fnFunction to the activeTitlePress event of this sap.m.MessageView.

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.MessageView itself.

Event fired when an activeTitle of a MessageItem 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 sap.m.MessageView itself

attachAfterOpen

Attaches event handler fnFunction to the afterOpen event of this sap.m.MessageView.

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.MessageView itself.

Event fired after the popover is opened.

Since 1.72 Use the appropriate event from the wrapper control, instead.
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 sap.m.MessageView itself

attachItemSelect

Attaches event handler fnFunction to the itemSelect event of this sap.m.MessageView.

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.MessageView itself.

Event fired when description is shown.

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 sap.m.MessageView itself

attachListSelect

Attaches event handler fnFunction to the listSelect event of this sap.m.MessageView.

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.MessageView itself.

Event fired when one of the lists is shown when (not) filtered by type.

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 sap.m.MessageView itself

attachLongtextLoaded

Attaches event handler fnFunction to the longtextLoaded event of this sap.m.MessageView.

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.MessageView itself.

Event fired when the long text description data from a remote URL is loaded.

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 sap.m.MessageView itself

attachUrlValidated

Attaches event handler fnFunction to the urlValidated event of this sap.m.MessageView.

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.MessageView itself.

Event fired when a validation of a URL from long text description is ready.

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 sap.m.MessageView itself

destroyHeaderButton

Destroys the headerButton in the aggregation headerButton.

destroyItems

Destroys all the items in the aggregation items.

detachActiveTitlePress

Detaches event handler fnFunction from the activeTitlePress event of this sap.m.MessageView.

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

detachAfterOpen

Detaches event handler fnFunction from the afterOpen event of this sap.m.MessageView.

The passed function and listener object must match the ones used for event registration.

Since 1.72 Use the appropriate event from the wrapper control, instead.
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

detachItemSelect

Detaches event handler fnFunction from the itemSelect event of this sap.m.MessageView.

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

detachListSelect

Detaches event handler fnFunction from the listSelect event of this sap.m.MessageView.

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

detachLongtextLoaded

Detaches event handler fnFunction from the longtextLoaded event of this sap.m.MessageView.

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

detachUrlValidated

Detaches event handler fnFunction from the urlValidated event of this sap.m.MessageView.

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

sap.m.MessageView.extend

Creates a new subclass of class sap.m.MessageView 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.

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

fireActiveTitlePress

Fires event activeTitlePress to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

item sap.m.MessageItem

Refers to the message item that contains the activeTitle.

fireAfterOpen

Fires event afterOpen to attached listeners.

Since 1.72 Use the appropriate event from the wrapper control, instead.
Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

openBy sap.ui.core.Control

This refers to the control which opens the popover.

fireItemSelect

Fires event itemSelect to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

item sap.m.MessageItem

Refers to the message item that is being presented.

messageTypeFilter sap.ui.core.MessageType

Refers to the type of messages being shown. See sap.ui.core.MessageType values for types.

fireListSelect

Fires event listSelect to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

messageTypeFilter sap.ui.core.MessageType

This parameter refers to the type of messages being shown.

fireLongtextLoaded

Fires event longtextLoaded to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireUrlValidated

Fires event urlValidated to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

getAsyncDescriptionHandler

Gets current value of property asyncDescriptionHandler.

Callback function for resolving a promise after description has been asynchronously loaded inside this function.

getAsyncURLHandler

Gets current value of property asyncURLHandler.

Callback function for resolving a promise after a link has been asynchronously validated inside this function.

getGroupItems

Gets current value of property groupItems.

Defines whether the MessageItems are grouped or not.

Default value is false.

getHeaderButton

Gets content of aggregation headerButton.

Sets a custom header button.

getItems

Gets content of aggregation items.

A list with message items. If only one item is provided, the initial page will be the details page for the item.

sap.m.MessageView.getMetadata

Returns a metadata object for class sap.m.MessageView.

getShowDetailsPageHeader

Gets current value of property showDetailsPageHeader.

Defines whether the header of details page will be shown.

Default value is true.

indexOfItem

Checks for the provided sap.m.MessageItem in the aggregation items. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oItem sap.m.MessageItem

The item whose index is looked for

insertItem

Inserts a item into the aggregation items.

Param Type DefaultValue Description
oItem sap.m.MessageItem

The item to insert; if empty, nothing is inserted

iIndex int

The 0-based index the item should be inserted at; for a negative value of iIndex, the item is inserted at position 0; for a value greater than the current size of the aggregation, the item is inserted at the last position

navigateBack

Navigates back to the list page

removeAllItems

Removes all the controls from the aggregation items.

Additionally, it unregisters them from the hosting UIArea.

removeItem

Removes a item from the aggregation items.

Param Type DefaultValue Description
vItem int string sap.m.MessageItem

The item to remove or its index or id

setAsyncDescriptionHandler

Sets a new value for property asyncDescriptionHandler.

Callback function for resolving a promise after description has been asynchronously loaded inside this function.

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

Param Type DefaultValue Description
oAsyncDescriptionHandler any

New value for property asyncDescriptionHandler

setAsyncURLHandler

Sets a new value for property asyncURLHandler.

Callback function for resolving a promise after a link has been asynchronously validated inside this function.

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

Param Type DefaultValue Description
oAsyncURLHandler any

New value for property asyncURLHandler

sap.m.MessageView.setDefaultHandlers

Setter for default description and URL validation callbacks across all instances of MessageView

Param Type DefaultValue Description
mDefaultHandlers object

An object setting default callbacks

asyncDescriptionHandler function

The description handler

asyncURLHandler function

The URL handler

setGroupItems

Sets a new value for property groupItems.

Defines whether the MessageItems are grouped or not.

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

Default value is false.

Param Type DefaultValue Description
bGroupItems boolean false

New value for property groupItems

setHeaderButton

Sets the aggregated headerButton.

Param Type DefaultValue Description
oHeaderButton sap.m.Button

The headerButton to set

setShowDetailsPageHeader

Sets a new value for property showDetailsPageHeader.

Defines whether the header of details page will be shown.

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

Default value is true.

Param Type DefaultValue Description
bShowDetailsPageHeader boolean true

New value for property showDetailsPageHeader