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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.