beforeAction
描述
在操作执行之前触发
用法
beforeAction: (
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 | boolean;
参数
事件的回调函数接受以下参数:
-
action- (必填)操作的名称。完整的可用操作列表请查看此处 -
config- (必填)包含操作参数的对象。属性集合取决于具体操作。该对象可包含:action- (可选)操作名称cell- (可选)操作所应用的单元格或单元格区域的 id,例如"A1"或"B2:D5"row- (可选)该单元格所在行的从零开始的索引col- (可选)该单元格所在列的从零开始的索引val- (可选)操作应用的新值,例如单元格的值、样式或尺寸prev- (可选)先前的值groupAction- (可选)当cell为单元格区域时,代替action执行的操作名称,例如"groupAction"、"groupRowAction"或"resizeCol"pageId- (可选)工作表的 idpageName- (可选)工作表的名称
当多个操作一起执行时(例如粘贴时),
action参数为"groupAction"