Class: FSheetHooks
Methods
onAfterCellEdit()
onAfterCellEdit(callback): IDisposable;The onAfterCellEdit event is fired after a cell is edited.
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | (params) => void | Callback function that will be called when the event is fired |
Returns
IDisposable
A disposable object that can be used to unsubscribe from the event
Deprecated
use univerAPI.addEvent(univerAPI.Event.SheetEditEnded, (params) => {}) instead
Example
univerAPI.getSheetHooks().onAfterCellEdit((params) => {console.log(params)})onBeforeCellEdit()
onBeforeCellEdit(callback): IDisposable;The onBeforeCellEdit event is fired before a cell is edited.
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | (params) => void | Callback function that will be called when the event is fired |
Returns
IDisposable
A disposable object that can be used to unsubscribe from the event
Deprecated
use univerAPI.addEvent(univerAPI.Event.BeforeSheetEditStart, (params) => {}) instead
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
| Parameter | Type | Description |
|---|---|---|
callback | (cellPos) => void | Callback function that will be called when the event is fired |
Returns
IDisposable
A disposable object that can be used to unsubscribe from the event
Deprecated
use univerAPI.addEvent(univerAPI.Event.DragOver, (params) => {}) instead
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
| Parameter | Type | Description |
|---|---|---|
callback | (cellPos) => void | Callback function that will be called when the event is fired |
Returns
IDisposable
A disposable object that can be used to unsubscribe from the event
Deprecated
use univerAPI.addEvent(univerAPI.Event.Drop, (params) => {}) instead
Example
univerAPI.getSheetHooks().onCellDrop((cellPos) => { console.log(cellPos)});onCellPointerMove()
onCellPointerMove(callback): IDisposable;The onCellPointerMove event is fired when a pointer changes coordinates.
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | (cellPos) => void | function that will be called when the event is fired |
Returns
IDisposable
A disposable object that can be used to unsubscribe from the event
Deprecated
use univerAPI.addEvent(univerAPI.Event.CellPointerMove, (params) => {}) instead
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
| Parameter | Type | Description |
|---|---|---|
callback | (cellPos) => void | function that will be called when the event is fired |
Returns
IDisposable
A disposable object that can be used to unsubscribe from the event
Deprecated
use univerAPI.addEvent(univerAPI.Event.CellHover, (params) => {}) instead
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
| Parameter | Type | Description |
|---|---|---|
customRender | Nullable<…[]> | Custom render function |
effect? | InterceptorEffectEnum | The effect of the interceptor |
priority? | number | The 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);
}
},
}])