Deactivate/drop dhtmlxEvent


Hello,


In application I use dhtmlxEvent(document.body,“click”,function(){ mycal.close();}); to close calendar when clicked outside calendar object.


My question is: How to deactivate/drop this event?


This event is active even when object is no longer available on page but still do his unnecessary work.

There is no backward method included in common library, but can be done as

var custom_call = function(){ mycal.close();
dhtmlxEvent(document.body,“click”,custom_call);

//when event need to be removed
if (_isIE)
document.body.detachEvent(“onclick”,custom_call);
else
document.body.removeEventListener(“click”,custom_call);