Skip to main content

on()

Description

Attaches a handler to an inner event of Spreadsheet

Usage

on(name: string, callback: function): void;

Parameters

  • name - (required) the event's name, case-insensitive
  • callback - (required) the handler function

Example

const spreadsheet = new dhx.Spreadsheet("spreadsheet", {
// config parameters
});
spreadsheet.parse(data);

spreadsheet.events.on("StyleChange", function(id){
console.log("The style of cell "+spreadsheet.selection.get()+" is changed");
});
info

See the full list of the Spreadsheet events here.

You can attach several handlers to the same event and all of them will be executed. If some of handlers return false, the related operations will be blocked. Event handlers are processed in the same order that they are attached.

Related articles: Event Handling

Related sample: Spreadsheet. Events