Skip to main content

GridCell<TData>

Defined in: src/grid.ts:494

Represents a grid cell

Type Parameters

Type ParameterDefault type
TDataany

Constructors

Constructor

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

Defined in: src/grid.ts:497

Parameters

ParameterType
dartany

Returns

GridCell<TData>

Properties

PropertyTypeDefined in
dartanysrc/grid.ts:495

Accessors

bounds

Get Signature

get bounds(): Rect

Defined in: src/grid.ts:601

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

Returns

Rect


cell

Get Signature

get cell(): Cell

Defined in: src/grid.ts:578

Returns

Cell

Corresponding table cell.


cellType

Get Signature

get cellType(): string

Defined in: src/grid.ts:516

Returns

string

Cell type

Set Signature

set cellType(x): void

Defined in: src/grid.ts:521

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

Parameters
ParameterType
xstring
Returns

void


color

Get Signature

get color(): number

Defined in: src/grid.ts:596

Calculates cell background color, according to color-coding.

Returns

number


customText

Get Signature

get customText(): string

Defined in: src/grid.ts:569

Custom text to be shown in a cell .

Returns

string

Set Signature

set customText(x): void

Defined in: src/grid.ts:570

Parameters
ParameterType
xstring
Returns

void


documentBounds

Get Signature

get documentBounds(): Rect

Defined in: src/grid.ts:606

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

Returns

Rect


element

Get Signature

get element(): HTMLElement

Defined in: src/grid.ts:622

Gets or sets HTML element for this grid cell.

Returns

HTMLElement

Set Signature

set element(e): void

Defined in: src/grid.ts:623

Parameters
ParameterType
eHTMLElement
Returns

void


grid

Get Signature

get grid(): Grid

Defined in: src/grid.ts:573

Returns

Grid

this cell belongs to.


gridColumn

Get Signature

get gridColumn(): GridColumn<TData>

Defined in: src/grid.ts:561

Returns

GridColumn<TData>

Corresponding grid column.


gridRow

Get Signature

get gridRow(): number

Defined in: src/grid.ts:556

Returns

number

Index of the corresponding grid row.


isColHeader

Get Signature

get isColHeader(): boolean

Defined in: src/grid.ts:536

Returns

boolean

Whether this is a column header.


isRowHeader

Get Signature

get isRowHeader(): boolean

Defined in: src/grid.ts:531

Returns

boolean

Whether this is a row header.


isTableCell

Get Signature

get isTableCell(): boolean

Defined in: src/grid.ts:526

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: src/grid.ts:566

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

Returns

string


renderer

Get Signature

get renderer(): GridCellRenderer

Defined in: src/grid.ts:613

Returns grid cell renderer.

Returns

GridCellRenderer


style

Get Signature

get style(): GridCellStyle

Defined in: src/grid.ts:591

Returns

GridCellStyle

Style to use for rendering.


tableColumn

Get Signature

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

Defined in: src/grid.ts:541

Returns

Column<TData, TData> | null

Corresponding table column, or null.


tableRow

Get Signature

get tableRow(): Row | null

Defined in: src/grid.ts:546

Returns

Row | null

Corresponding table row, or null.


tableRowIndex

Get Signature

get tableRowIndex(): number | null

Defined in: src/grid.ts:551

Returns

number | null

Index of the corresponding table row.


value

Get Signature

get value(): TData

Defined in: src/grid.ts:586

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: src/grid.ts:617

Parameters

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

Returns

void


setValue()

setValue(x, notify?): void

Defined in: src/grid.ts:626

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: src/grid.ts:511

Parameters

ParameterType
gridColumnGridColumn

Returns

GridCell


fromColumnRow()

static fromColumnRow(grid, columnName, gridRow): GridCell

Defined in: src/grid.ts:502

Parameters

ParameterType
gridGrid
columnNamestring
gridRownumber

Returns

GridCell


fromValue()

static fromValue(value): GridCell

Defined in: src/grid.ts:507

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

Parameters

ParameterType
valueany

Returns

GridCell