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 actioncell- (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 cellcol- (optional) the zero-based index of the column of the cellval- (optional) the new value that the action applies, for example, a cell value, a style or a sizeprev- (optional) the previous valuegroupAction- (optional) the name of the action that is executed instead ofactionwhencellis a range of cells, for example,"groupAction","groupRowAction"or"resizeCol"pageId- (optional) the id of the sheetpageName- (optional) the name of the sheet
When several actions are executed together, for example, on paste, the
actionparameter is"groupAction", andconfigis 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: