detachAllEvents

detaches all events from dhtmlxGantt (both custom and inner ones)

void detachAllEvents();

Deprecated

The method is deprecated.

Example

gantt.attachEvent("onTaskClick", function(id, e) {
    alert("You've just clicked an item with id="+id);
});
gantt.attachEvent("onTaskDblClick", function(id, e) {
    alert("You've just double clicked an item with id="+id);
});
 
gantt.detachAllEvents();

Details

Note, using the detachAllEvents method can break the functionality of dhtmlxGantt, as it removes ALL event handlers at a time: those defined by a custom logic and those defined by dhtmlxGantt itself (to link different parts and functionality).

A safer approach is to store the result of the attachEvent method and to use the detachEvent method to detach saved events when necessary, as shown in the example above.


The detachAllEvents method is deprecated. Instead of it, you can use:

// save handler ids when attaching events
var events = [];
events.push(gantt.attachEvent("onTaskClick", function(id, e) {
    alert("You've just clicked an item with id="+id);
});
events.push(gantt.attachEvent("onTaskDblClick", function(id, e) {
    alert("You've just double clicked an item with id="+id);
});
 
// detach all saved events
while (events.length)
   gantt.detachEvent(events.pop());
See also
Back to top