Skip to Content
0
Jul 28, 2020 at 08:29 AM

How to detach event in UI5

797 Views Last edit Jul 28, 2020 at 09:28 AM 4 rev

Hello,

I am trying to attach and detach event with open ui 5. But it does not work and the only relevant article on this seems to be this.


I am trying the most basic stuff here: call attachEvent() with a given ID and in the handler function I just call detachEvent(). My base object is a global variable and it is visible. I can see its "mEventRegistry" property but calling the detachEvent() does nothing.

Can someone provide a relevant working example as the developers seems to think that working code examples are redundant and one should find how stuff is working by himself.

Edit:

onWorkScheduleUpdated:function(eventId, settings) {
    ContextUtils.get().attachEvent("eventId" + eventId, settings, () => {
        ContextUtils.get().detachEvent("eventId" + eventId, () => {});
    });
},

Thanks a lot in advance!