Skip to main content

GridCell<TData>

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

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:474

Parameters

ParameterType
dartany

Returns

GridCell<TData>

Properties

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

Accessors

bounds

Get Signature

get bounds(): Rect

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

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:555

Returns

Cell

Corresponding table cell.


cellType

Get Signature

get cellType(): string

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

Returns

string

Cell type

Set Signature

set cellType(x): void

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

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:573

Calculates cell background color, according to color-coding.

Returns

number


customText

Get Signature

get customText(): string

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

Custom text to be shown in a cell .

Returns

string

Set Signature

set customText(x): void

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

Parameters
ParameterType
xstring
Returns

void


documentBounds

Get Signature

get documentBounds(): Rect

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

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:599

Gets or sets HTML element for this grid cell.

Returns

HTMLElement

Set Signature

set element(e): void

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

Parameters
ParameterType
eHTMLElement
Returns

void


grid

Get Signature

get grid(): Grid

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

Returns

Grid

this cell belongs to.


gridColumn

Get Signature

get gridColumn(): GridColumn<TData>

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

Returns

GridColumn<TData>

Corresponding grid column.


gridRow

Get Signature

get gridRow(): number

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

Returns

number

Index of the corresponding grid row.


isColHeader

Get Signature

get isColHeader(): boolean

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

Returns

boolean

Whether this is a column header.


isRowHeader

Get Signature

get isRowHeader(): boolean

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

Returns

boolean

Whether this is a row header.


isTableCell

Get Signature

get isTableCell(): boolean

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

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:543

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

Returns

string


renderer

Get Signature

get renderer(): GridCellRenderer

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

Returns grid cell renderer.

Returns

GridCellRenderer


style

Get Signature

get style(): GridCellStyle

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

Returns

GridCellStyle

Style to use for rendering.


tableColumn

Get Signature

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

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

Returns

Column<TData, TData> | null

Corresponding table column, or null.


tableRow

Get Signature

get tableRow(): Row | null

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

Returns

Row | null

Corresponding table row, or null.


tableRowIndex

Get Signature

get tableRowIndex(): number | null

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

Returns

number | null

Index of the corresponding table row.


value

Get Signature

get value(): TData

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

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:594

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:603

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:488

Parameters

ParameterType
gridColumnGridColumn

Returns

GridCell


fromColumnRow()

static fromColumnRow(grid, columnName, gridRow): GridCell

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

Parameters

ParameterType
gridGrid
columnNamestring
gridRownumber

Returns

GridCell


fromValue()

static fromValue(value): GridCell

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

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

Parameters

ParameterType
valueany

Returns

GridCell