Skip to main content

Event handling

Attaching event listeners

You can attach event listeners with the spreadsheet.events.on() method:

spreadsheet.events.on("AfterColumnAdd", function(cells){
console.log("A new column is added");
});

Detaching event listeners

To detach events, use spreadsheet.events.detach():

var addcolumn = spreadsheet.events.on("AfterColumnAdd", function(cells){
console.log("A new column is added");
});
spreadsheet.events.detach(addcolumn);

Calling events

To call events, use spreadsheet.events.fire():

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

The list of events is available in the API section.

note

The names of events are case-insensitive.