Skip to Content

sapui5 tutorial for message handling / MessagePopover?

Hi,

I tried to use the MessagePopover control together with the MessageManager for displaying error messages but I don´t get it to work.

That´s why I´m wondering if there is a good tutorial which explains the handling at a working example. Using Google I didn´t find anything real useful for my case.

But maybe you have an idea.

That´s my coding where I built the messages:

var oMessageProcessor = new sap.ui.core.message.ControlMessageProcessor();
var oMessageManager = sap.ui.getCore().getMessageManager();

oMessageManager.registerMessageProcessor(oMessageProcessor);
oMessageManager.addMessages(
  new sap.ui.core.message.Message({
  message: "Enter a System ID",
  description: "Enter a System ID",
  type: sap.ui.core.MessageType.Error,
  target: "txtSystemID/value",
  processor: oMessageProcessor
  })
);
this.getView().setModel(oMessageManager.getMessageModel(), "message");

The view definition looks like this:

<MessagePopover afterClose="" afterOpen="" beforeClose="" beforeOpen="" id="msgPopover" initiallyExpanded="true" itemSelect=""
  items="{message>/}" listSelect="" placement="Vertical" xmlns="sap.m">
  <items>
  <MessagePopoverItem description="{description}" title="{message}" type="{type}"></MessagePopoverItem>
  </items>
  <!-- sap.m.MessagePopoverItem -->
</MessagePopover>

When I open the MessagePopover it has one item but it shows no text:

I don´t know why it shows no text. Is my binding wrong? Or is my whole approach not correct?

I found the example SAPUI5 Explored MessagePopover but it doesn´t deal with MessageManager. So is my approach the recommended way or shall I use an own model for storing the messages?


Thanks, Sebastian

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 03, 2015 at 12:49 PM

    Hi,

    I found the solution here:

    http://help.sap.com/saphelp_nw74/helpdata/en/89/56f0a223284d729900ebad4ca88356/content.htm

    In short the following changes have to be done:

    <MessagePopover afterClose="" afterOpen="" beforeClose="" beforeOpen="" id="msgPopover" initiallyExpanded="true" itemSelect=""
      items="{message>/}" listSelect="" placement="Vertical" xmlns="sap.m">
      <items>
      <MessagePopoverItem description="{message>description}" title="{message>message}" type="{message>type}"></MessagePopoverItem>
      </items>
      <!-- sap.m.MessagePopoverItem -->
    </MessagePopover>
    

    Best regards,

    Sebastian

    Add comment
    10|10000 characters needed characters exceeded