Skip to main content

GridCell<TData>

Represents a grid cell

Type parameters

Type parameterValue
TDataany

Constructors

new GridCell()

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

Parameters

ParameterType
dartany

Returns

GridCell<TData>

Source

src/grid.ts:497

Properties

PropertyType
dartany

Accessors

bounds

get bounds(): Rect

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

Returns

Rect

Source

src/grid.ts:601


cell

get cell(): Cell

Returns

Cell

Corresponding table cell.

Source

src/grid.ts:578


cellType

get cellType(): string

set cellType(x): void

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

Parameters

ParameterType
xstring

Returns

string

Cell type

Source

src/grid.ts:516


color

get color(): number

Calculates cell background color, according to color-coding.

Returns

number

Source

src/grid.ts:596


customText

get customText(): string

Custom text to be shown in a cell .

set customText(x): void

Parameters

ParameterType
xstring

Returns

string

Source

src/grid.ts:569


documentBounds

get documentBounds(): Rect

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

Returns

Rect

Source

src/grid.ts:606


element

get element(): HTMLElement

Gets or sets HTML element for this grid cell.

set element(e): void

Parameters

ParameterType
eHTMLElement

Returns

HTMLElement

Source

src/grid.ts:622


grid

get grid(): Grid

Returns

Grid

this cell belongs to.

Source

src/grid.ts:573


gridColumn

get gridColumn(): GridColumn<TData>

Returns

GridColumn<TData>

Corresponding grid column.

Source

src/grid.ts:561


gridRow

get gridRow(): number

Returns

number

Index of the corresponding grid row.

Source

src/grid.ts:556


isColHeader

get isColHeader(): boolean

Returns

boolean

Whether this is a column header.

Source

src/grid.ts:536


isRowHeader

get isRowHeader(): boolean

Returns

boolean

Whether this is a row header.

Source

src/grid.ts:531


isTableCell

get isTableCell(): boolean

Returns

boolean

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

Source

src/grid.ts:526


position

get position(): string

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

Returns

string

Source

src/grid.ts:566


renderer

get renderer(): GridCellRenderer<any>

Returns grid cell renderer.

Returns

GridCellRenderer<any>

Source

src/grid.ts:613


style

get style(): GridCellStyle

Returns

GridCellStyle

Style to use for rendering.

Source

src/grid.ts:591


tableColumn

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

Returns

null | Column<TData, TData>

Corresponding table column, or null.

Source

src/grid.ts:541


tableRow

get tableRow(): null | Row

Returns

null | Row

Corresponding table row, or null.

Source

src/grid.ts:546


tableRowIndex

get tableRowIndex(): null | number

Returns

null | number

Index of the corresponding table row.

Source

src/grid.ts:551


value

get value(): TData

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

Source

src/grid.ts:586

Methods

render()

render(options?): void

Parameters

ParameterType
options?object
options.bounds?Rect
options.context?CanvasRenderingContext2D

Returns

void

Source

src/grid.ts:617


setValue()

setValue(x, notify): void

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

Parameters

ParameterTypeDefault value
xanyundefined
notifybooleantrue

Returns

void

Source

src/grid.ts:626


createColHeader()

static createColHeader(gridColumn): GridCell<any>

Parameters

ParameterType
gridColumnGridColumn<any>

Returns

GridCell<any>

Source

src/grid.ts:511


fromColumnRow()

static fromColumnRow(grid, columnName, gridRow): GridCell<any>

Parameters

ParameterType
gridGrid
columnNamestring
gridRownumber

Returns

GridCell<any>

Source

src/grid.ts:502


fromValue()

static fromValue(value): GridCell<any>

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

Parameters

ParameterType
valueany

Returns

GridCell<any>

Source

src/grid.ts:507