Skip to Content

How to format sap.m.MessagePopoverItem as HTML?

Jan 09 at 04:04 PM


avatar image

Dear colleagues,

while writing a message plugin for FLP on SAP EP 7.5 SP7 I faced following problem. Im reading some messages as JSON from a custom component to render those within FLP. Since the messages are originally created in a HTML editor, those are formatted, means containing HTML tags. This looks approx like this:

var _showMessages = function(oEvent) {
	var oMessageTemplate = new sap.m.MessagePopoverItem({
		type: '{type}',
		title: '{title}',
		description: '{description}',
		counter: '{counter}'

	var oMessagePopover = new sap.m.MessagePopover({
		items: {
			path: '/',
			template: oMessageTemplate
	//if messages are avaiable append notification bubble and fill those in corresponding categories
	var sUrl = "/irj/servlet/prt/prtrw/prtroot/xxx.MessagesComponent";
		url: sUrl,
		async: false,
		timeout: 10000,
		error: function(){
			$.sap.log.error("Could not load system messages...");
		success: function(data, status, jqXHR){
			if (typeof data !== 'undefined' && data.messages.length > 0) {
				var messages = data;
				$("#messageBtn").prepend("<span id='bubble_MessageBtn' class='notify-bubble' />");
				var jsonMessages = [];
				var counter = 0;
				for (var i=0; i < data.messages.length; i++)
					jsonMessages[i] = {
						type: 'Information',
						title: data.messages[i].title,
						description: data.messages[i].text,
						counter: counter
				var oModel = new sap.ui.model.json.JSONModel();

				var viewModel = new sap.ui.model.json.JSONModel();
				viewModel.setData({messagesLength: jsonMessages.length + ''});

			else {



So at the end it works well, but I can see the html tags within description: data.messages[i].text, self evident is: I dont want them, I need clean formatting.

So I checked but didnt found anything for my purposes. Does anybody knows how to overcome this? Thank you very much,


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers