Show TOC

Message ModelLocate this document in the navigation structure

The message model contains all messages and is used to bind to the messages to display them to the user.

The message model is retrieved from the message manager by calling the getMessageModel() method. For an example how to bind to the message model and show the messages to the user, see sap.m.MessagePopover in the API reference. You can use it directly in the application, or you can use it as a reference implementation.

Using the Message Model

You use the message model like any other model to bind an aggregation to a root path ("/), for example the items in a list, and add filters and sorters. The MessagePopOver control is used to display the messages to the user:

var oMessagePopoverButton = new sap.m.Button({
    text: "Show MessagePopover",
    type: "Accept",
    press: function() {
        oMP.openBy(this);
    }
});

var oMP = new sap.m.MessagePopover({
    items: {
        path:"message>/",
        template: new sap.m.MessagePopoverItem({ description: "{message>description}", type: "{message>type}", title: "{message>message}"})
    }
});

oMP.setModel (sap.ui.getCore().getMessageManager().getMessageModel(),"message");

oMessagePopoverButton.placeAt("content");