Skip to Content
0
Oct 23, 2013 at 10:56 AM

How to use attachEvent() correctly

5029 Views

Hi,

the following question raised up only because we are/must using the sap.ui.core.Message in a ux3.Shell as this is mandatory for the notification bar. Our use case want to have the functionality to react on the click event of the message. The message itself does not have a pre-defined event "press".

Therefore I think about to add a common event "onclick" via "attachEvent". My approach fails currently on I would like to understand, what needs to be done.

My code looks like this:

     var oMessageNotifier = new sap.ui.ux3.Notifier( {
title : "Your system messages"
});
oNotr.addNotifier(oMessageNotifier); oNotiBar.setVisibleStatus(sap.ui.ux3.NotificationBarStatus.Default); var error = new sap.ui.core.Message("msg", {text:"fooBuh"});

error.attachEvent("onclick",function(event){alert('foo');});
oMessageNotifier.addMessage(error);