Skip to main content

afterAction

Description​

Fires after an action is executed

Usage​

afterAction: (
action: string,
config: {
action?: string,
cell?: string,
row?: number,
col?: number,
val?: any,
prev?: any,
groupAction?: string,
pageId?: string | number,
pageName?: string,
// other properties of the action
} | object[]
) => void;

Parameters​

The callback of the event takes the following parameters:

  • action - (required) the name of the action. Check the full list of available actions here

  • config - (required) an object with parameters of the action. The set of properties depends on the action. The object can include:

    • action - (optional) the name of the action
    • cell - (optional) the id of the cell or the range of cells the action is applied to, for example, "A1" or "B2:D5"
    • row - (optional) the zero-based index of the row of the cell
    • col - (optional) the zero-based index of the column of the cell
    • val - (optional) the new value that the action applies, for example, a cell value, a style or a size
    • prev - (optional) the previous value
    • groupAction - (optional) the name of the action that is executed instead of action when cell is a range of cells, for example, "groupAction", "groupRowAction" or "resizeCol"
    • pageId - (optional) the id of the sheet
    • pageName - (optional) the name of the sheet

    When several actions are executed together, for example, on paste, the action parameter is "groupAction", and config is an array of such objects.

Example​

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

spreadsheet.events.on("afterAction", (actionName, config) => {
if (actionName === "sortCells") {
console.log(actionName, config);
}
});

Changelog: Added in v4.3

Related articles: