Skip to main content

Event handling

Attaching event listeners​

You can add a custom handler to any event of Layout with the layout.events.on() method. The method takes the following parameters:

evNamethe event name
evHandlera custom event handler
layout.events.on("beforeHide", function(id){
console.log("The id of a cell", id);
});

You can attach several handlers to the same event, and Layout runs all of them.

note

Event names are case-insensitive.

Related sample: Layout. Events

Detaching event listeners​

The layout.events.detach() method removes an event handler:

layout.events.on("beforeHide", function(id){
console.log("The id of a cell", id);
});

layout.events.detach("beforeHide");

Calling events​

The layout.events.fire() method calls an event:

layout.events.fire("beforeHide",args);
// where args is an array of arguments

List of supported events​

You can find the full list of Layout events in the API Reference.