Check documentation for the latest version of dhtmlxSuite Handling Events DHTMLX Docs

Handling Events

Attaching events

The attachEvent() method can be used to add an event handler to any of the available events. The method needs to be called with the following parameters:

function my_handler(){ do_something(); };
view.attachEvent("onSomeEvent",my_handler);

Several handlers can be attached to one and the same event and all of them will be executed.

The names of the events are case-insensitive.

Detaching events

There is a simple way of removing an event handler:

var id = view.attachEvent("onSomeEvent",my_handler);
...
view.detachEvent(id); // unique id of the event handler

Naming tips

  • events which start with "before" - can be blocked, returning true from such an event handler will confirm the operation, returning false or not returning anything will block the default event processing;
  • events which start with "after" - can't be blocked, but have a sibling event the name of which starts with "before".

The list of events

You can find the full list of events in the DataView API.

Back to top