[]
        
(Showing Draft Content)

GC.Spread.Sheets.DataRange.IDataProvider

Interface: IDataProvider

Sheets.DataRange.IDataProvider

Table of contents

Properties

Methods

Properties

host

host: DataRange

The data provider host.

Methods

fromJSON

Optional fromJSON(options): void

Implement this hook to handle the deserialization.

Parameters

Name Type
options Object
options.typeName string

Returns

void


getSpans

Optional getSpans(row, col, rowCount, colCount): Range[]

Implement this hook to provide spans to data range cells. The row, col, rowCount and colCount parameters are based on the data range axis.

Parameters

Name Type
row number
col number
rowCount number
colCount number

Returns

Range[]


getStyle

Optional getStyle(row, col): Style

Implement this hook to provide styles to data range cells. The row and col parameters are based on the data range axis. It should return the style as GC.Spread.Sheets.Style, otherwise, means fail to get style from data provider, so it will continue to get the style from sheet model.

Parameters

Name Type
row number
col number

Returns

Style


getValue

Optional getValue(row, col): unknown

Implement this hook to provide values to data range cells. The row and col parameters are based on the data range axis. If returns undefined, it means fail to get value from data provider, so it will continue to get the value from sheet model.

Parameters

Name Type
row number
col number

Returns

unknown


onClear

Optional onClear(row, col, rowCount, colCount, changes): boolean

Implement this hook to handle the clear contents action. Return false means prevent to clear data range contents. Default is false.

Parameters

Name Type
row number
col number
rowCount number
colCount number
changes any[]

Returns

boolean


onColumnChange

Optional onColumnChange(col, colCount, changeType, changes): void

Implement this hook to receive changed columns information. The col and colCount parameters are based on the data range axis. Post your change into changes parameter if you want undo/redo.

Parameters

Name Type
col number
colCount number
changeType "delete" | "add"
changes any[]

Returns

void


onContextMenu

Optional onContextMenu(row, col, e): boolean

Implement this hook to handle the mouse context menu action. The row and col parameters are based on the data range axis. Return true means prevent the next sheet actions. Default is false.

Parameters

Name Type
row number
col number
e MouseEvent

Returns

boolean


onCopy

Optional onCopy(name): boolean | { dataProvider: IDataProvider ; name: string }

Implement this hook to handle the copy action. Input parameter name is copied data range name, need to return a different new data range name and a data provider instance. Return false means prevent to copy data range. Default is false.

Parameters

Name Type
name string

Returns

boolean | { dataProvider: IDataProvider ; name: string }


onDestroy

Optional onDestroy(): void

Implement this hook to handle the destroy action.

Returns

void


onDoubleClick

Optional onDoubleClick(row, col, e): boolean

Implement this hook to handle the mouse double click action. The row and col parameters are based on the data range axis. Return true means prevent the next sheet actions. Default is false.

Parameters

Name Type
row number
col number
e MouseEvent

Returns

boolean


onKeyDown

Optional onKeyDown(row, col, e): boolean

Implement this hook to handle the key down action. The row and col parameters are based on the data range axis. Return true means prevent the next sheet actions. Default is false.

Parameters

Name Type
row number
col number
e KeyboardEvent

Returns

boolean


onKeyUp

Optional onKeyUp(row, col, e): boolean

Implement this hook to handle the key down action. The row and col parameters are based on the data range axis. Return true means prevent the next sheet actions. Default is false.

Parameters

Name Type
row number
col number
e KeyboardEvent

Returns

boolean


onMouseDown

Optional onMouseDown(row, col, e): boolean

Implement this hook to handle the mouse down action. The row and col parameters are based on the data range axis. Return true means prevent the next sheet actions. Default is false.

Parameters

Name Type
row number
col number
e MouseEvent

Returns

boolean


onMouseMove

Optional onMouseMove(row, col, e): boolean

Implement this hook to handle the mouse move action. The row and col parameters are based on the data range axis. Return true means prevent the next sheet actions. Default is false.

Parameters

Name Type
row number
col number
e MouseEvent

Returns

boolean


onMouseUp

Optional onMouseUp(row, col, e): boolean

Implement this hook to handle the mouse up action. The row and col parameters are based on the data range axis. Return true means prevent the next sheet actions. Default is false.

Parameters

Name Type
row number
col number
e MouseEvent

Returns

boolean


onMouseWheel

Optional onMouseWheel(deltaX, deltaY, e): boolean

Implement this hook to handle the mouse wheel action. Return true means prevent the next sheet actions. Default is false.

Parameters

Name Type
deltaX number
deltaY number
e MouseEvent

Returns

boolean


onRowChange

Optional onRowChange(row, rowCount, changeType, changes): void

Implement this hook to receive changed rows information. The row and rowCount parameters are based on the data range axis. Post your change into changes parameter if you want undo/redo.

Parameters

Name Type
row number
rowCount number
changeType "delete" | "add"
changes any[]

Returns

void


setValue

Optional setValue(row, col, value, changes): boolean

Implement this hook to receive the changed values from data range. The row and col parameters are based on the data range axis. Post your change into changes parameter if you want undo/redo. If returns true, it means set value successfully to data provider, so it will prevent to set the value to sheet model.

Parameters

Name Type
row number
col number
value unknown
changes any[]

Returns

boolean


toJSON

Optional toJSON(): Object

Implement this hook to handle the serialization.

Returns

Object

Name Type
typeName string

undo

Optional undo(change): void

Implement this hook to handle the undo action. Input parameter change is the user created in the corresponding hooks.

Parameters

Name Type
change any

Returns

void