After creating a new gantt instance with:-

var gantt1 = Gantt.getGanttInstance();

I am finding that the following code doesn’t add the required event:-

if (gantt1.checkEvent(“onAfterLinkAdd”) === false) {
gantt1.attachEvent(“onAfterLinkAdd”, Gantt_AddLink);

Because the checkEvent is returning true for this particular event. I am using the same construct for checking for other event handlers (“onAfterTaskDrag”, “onAfterLinkDelete”, “onAfterAutoSchedule”) and they all return false as expected.

Please help. Many thanks.

This is an expected behavior. checkEvent returns true if an event has at least one listener. In this case something in gantt sources can listen to that event (most probably it’s dataProcessor). Btw, I think gantt.checkEvent(‘onAfterLinkDelete’) also returns true since dataProcessor listens to onAfterLinkAdd/Delete/Update.
You’ll need to define some flags manually in order to keep track of listeners. Detecting them with gantt.checkEvent is not reliable since your code may be not the only one that adds listeners to events you use.