Skip to main content

GridCell<TData>

Defined in: js-api/src/grid.ts:474

Represents a grid cell

Type Parameters​

Type ParameterDefault type
TDataany

Constructors​

Constructor​

new GridCell<TData>(dart): GridCell<TData>

Defined in: js-api/src/grid.ts:477

Parameters​

ParameterType
dartany

Returns​

GridCell<TData>

Properties​

PropertyTypeDefined in
dartanyjs-api/src/grid.ts:475

Accessors​

bounds​

Get Signature​

get bounds(): Rect

Defined in: js-api/src/grid.ts:585

Grid cell bounds. Sample: https://public.datagrok.ai/js/samples/grid/advanced/cell-bounds

Returns​

Rect


cell​

Get Signature​

get cell(): Cell

Defined in: js-api/src/grid.ts:562

Returns​

Cell

Corresponding table cell.


cellType​

Get Signature​

get cellType(): string

Defined in: js-api/src/grid.ts:496

Returns​

string

Cell type

Set Signature​

set cellType(x): void

Defined in: js-api/src/grid.ts:501

Allows to set cell type (needed when rendering single grid cell)

Parameters​
ParameterType
xstring
Returns​

void


color​

Get Signature​

get color(): number

Defined in: js-api/src/grid.ts:580

Calculates cell background color, according to color-coding.

Returns​

number


customText​

Get Signature​

get customText(): string

Defined in: js-api/src/grid.ts:553

Custom text to be shown in a cell .

Returns​

string

Set Signature​

set customText(x): void

Defined in: js-api/src/grid.ts:554

Parameters​
ParameterType
xstring
Returns​

void


documentBounds​

Get Signature​

get documentBounds(): Rect

Defined in: js-api/src/grid.ts:590

Grid cell bounds, relative to the document. Useful for showing hints, tooltips, etc.

Returns​

Rect


element​

Get Signature​

get element(): HTMLElement

Defined in: js-api/src/grid.ts:606

Gets or sets HTML element for this grid cell.

Returns​

HTMLElement

Set Signature​

set element(e): void

Defined in: js-api/src/grid.ts:607

Parameters​
ParameterType
eHTMLElement
Returns​

void


grid​

Get Signature​

get grid(): Grid

Defined in: js-api/src/grid.ts:557

Returns​

Grid

this cell belongs to.


gridColumn​

Get Signature​

get gridColumn(): GridColumn<TData>

Defined in: js-api/src/grid.ts:545

Returns​

GridColumn<TData>

Corresponding grid column.


gridRow​

Get Signature​

get gridRow(): number

Defined in: js-api/src/grid.ts:540

Returns​

number

Index of the corresponding grid row.


isColHeader​

Get Signature​

get isColHeader(): boolean

Defined in: js-api/src/grid.ts:516

Returns​

boolean

Whether this is a column header.


isRowHeader​

Get Signature​

get isRowHeader(): boolean

Defined in: js-api/src/grid.ts:511

Returns​

boolean

Whether this is a row header.


isTableCell​

Get Signature​

get isTableCell(): boolean

Defined in: js-api/src/grid.ts:506

Returns​

boolean

Whether this is a table (data) cell (as opposed to special cells like row headers).


position​

Get Signature​

get position(): string

Defined in: js-api/src/grid.ts:550

For debugging mostly. Returns ${this.gridColumn.name}: ${this.gridRow}.

Returns​

string


renderer​

Get Signature​

get renderer(): GridCellRenderer

Defined in: js-api/src/grid.ts:597

Returns grid cell renderer.

Returns​

GridCellRenderer


style​

Get Signature​

get style(): GridCellStyle

Defined in: js-api/src/grid.ts:575

Returns​

GridCellStyle

Style to use for rendering.


tableColumn​

Get Signature​

get tableColumn(): Column<TData, TData> | null

Defined in: js-api/src/grid.ts:521

Returns​

Column<TData, TData> | null

Corresponding table column, or null.


tableRow​

Get Signature​

get tableRow(): Row | null

Defined in: js-api/src/grid.ts:526

Returns​

Row | null

Corresponding table row, or null.


tableRowIndex​

Get Signature​

get tableRowIndex(): number | null

Defined in: js-api/src/grid.ts:531

Returns​

number | null

Index of the corresponding table row.


value​

Get Signature​

get value(): TData

Defined in: js-api/src/grid.ts:570

Returns the value of the grid cell. Note that the value could differ from the corresponding table cell due to the following:

  1. setting gridCell.value inside onPrepareCell
  2. as a result of evaluating onPrepareValueScript
Returns​

TData

Methods​

render()​

render(options?): void

Defined in: js-api/src/grid.ts:601

Parameters​

ParameterType
options?{ bounds?: Rect; context?: CanvasRenderingContext2D; }
options.bounds?Rect
options.context?CanvasRenderingContext2D

Returns​

void


setValue()​

setValue(x, notify?): void

Defined in: js-api/src/grid.ts:610

Sets the grid cell value and fires onCellValueEdited if notify is true

Parameters​

ParameterTypeDefault value
xanyundefined
notifybooleantrue

Returns​

void


createColHeader()​

static createColHeader(gridColumn): GridCell

Defined in: js-api/src/grid.ts:491

Parameters​

ParameterType
gridColumnGridColumn

Returns​

GridCell


fromColumnRow()​

static fromColumnRow(grid, columnName, gridRow): GridCell

Defined in: js-api/src/grid.ts:482

Parameters​

ParameterType
gridGrid
columnNamestring
gridRownumber

Returns​

GridCell


fromValue()​

static fromValue(value): GridCell

Defined in: js-api/src/grid.ts:487

Returns a synthecic GridCell that only contains value but no row/col. Useful for rendering values.

Parameters​

ParameterType
valueany

Returns​

GridCell