Skip to Content
ClassesFSheetHooks

Class: FSheetHooks

Extends

  • FBase.IFSheetHooksUIMixin

Methods

onAfterCellEdit()

onAfterCellEdit(callback): IDisposable

The onAfterCellEdit event is fired after a cell is edited.

Parameters

ParameterTypeDescription
callback(params) => voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Example

univerAPI.getSheetHooks().onAfterCellEdit((params) => {console.log(params)})

onBeforeCellEdit()

onBeforeCellEdit(callback): IDisposable

The onBeforeCellEdit event is fired before a cell is edited.

Parameters

ParameterTypeDescription
callback(params) => voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Example

univerAPI.getSheetHooks().onBeforeCellEdit((params) => {console.log(params)})

onCellDragOver()

onCellDragOver(callback): IDisposable

The onCellDragOver event is fired when an element or text selection is being dragged into a cell’s hit test boundaries.

Parameters

ParameterTypeDescription
callback(cellPos) => voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Example

univerAPI.getSheetHooks().onCellDragOver((cellPos) => { console.log(cellPos)});

onCellDrop()

onCellDrop(callback): IDisposable

The onCellDrop event is fired when an element or text selection is being dropped on the cell.

Parameters

ParameterTypeDescription
callback(cellPos) => voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Example

univerAPI.getSheetHooks().onCellDrop((cellPos) => { console.log(cellPos)});

onCellPointerMove()

onCellPointerMove(callback): IDisposable

The onCellPointerMove event is fired when a pointer changes coordinates.

Parameters

ParameterTypeDescription
callback(cellPos) => voidfunction that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Example

univerAPI.getSheetHooks().onCellPointerMove((cellPos) => { console.log(cellPos)});

onCellPointerOver()

onCellPointerOver(callback): IDisposable

The onCellPointerOver event is fired when a pointer is moved into a cell’s hit test boundaries.

Parameters

ParameterTypeDescription
callback(cellPos) => voidfunction that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Example

univerAPI.getSheetHooks().onCellPointerOver((cellPos) => { console.log(cellPos)});

onCellRender()

onCellRender( customRender, effect?, priority?): IDisposable

The onCellRender event is fired when a cell is rendered.

Parameters

ParameterTypeDescription
customRenderNullable<…[]>Custom render function
effect?InterceptorEffectEnumThe effect of the interceptor
priority?numberThe priority of the interceptor

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Example

univerAPI.getSheetHooks().onCellRender([{ drawWith: (ctx, info) => { const { row, col } = info; // Update to any cell location you want if (row === 1 && col === 2) { const { primaryWithCoord } = info; const { startX, startY } = primaryWithCoord; ctx.fillText('Univer', startX, startY + 10); } }, }])