Class: CellEvent

CellEvent

CellEvent is a very low-level object that needs to be super-efficient. JavaScript objects are well known to be light weight in general, but at this level we need to be careful.

These objects were originally only being created on mouse events. This was no big deal as mouse events are few and far between. However, as of v1.2.0, the renderer now also creates one for each visible cell on each and every grid paint.

For this reason, to maintain performance, each grid gets a custom definition of CellEvent, created by this class factory, with the following optimizations:

  • Use of extend-me is avoided because its initialize chain is a bit too heavy here.
  • Custom versions of CellEvent for each grid lightens the load on the constructor.

Constructor

new CellEvent(gridXopt, gridYopt)

Create a new CellEvent object.

All own enumerable properties are mixed into cell editor:

  • Includes this.column defined by constructor (as enumerable).
  • Excludes this.gridCell, this.dataCell, this.visibleRow.subgrid defined by constructor (as non-enumerable).
  • Any additional (enumerable) members mixed in by application's getCellEditorAt override.

Including the params calls resetGridCY(gridX, gridY). Alternatively, instantiate without params and/or later call one of these:

Parameters:
Name Type Attributes Description
gridX number <optional>

grid cell coordinate (adjusted for horizontal scrolling after fixed columns).

gridY number <optional>

grid cell coordinate, adjusted (adjusted for vertical scrolling if data subgrid)

Members

bounds

The bounds of the cell.

Properties:
Name Type Description
left number
top number
width number
height number

column :Column

A reference to the cell's Column object.

Enumerable so it will be copied to cell event on CellEvent.prototype.initialize.

Type:

dataCell :WritablePoint

Type:
Properties:
Name Type Description
x number

The data model's column index, unaffected by column scrolling; i.e., an index suitable for dereferencing the column object to which the cell belongs via Behavior#getColumn.

y number

The data model's row index, adjusted for data row scrolling after fixed rows.

dataRow :object

An object representing the whole data row, including hidden columns.

Type:
  • object

formattedValue

The formatted value of the cell.

gridCell :WritablePoint

Type:
Properties:
Name Type Description
x number

The active column index, adjusted for column scrolling after fixed columns; i.e., an index suitable for dereferencing the column object to which the cell belongs via Behavior#getActiveColumn.

y number

The vertical grid coordinate, unaffected by subgrid, row scrolling, and fixed rows.

isBottomTotalsCell :boolean

Type:
  • boolean

isBottomTotalsHandle :boolean

Type:
  • boolean

isBottomTotalsRow :boolean

Type:
  • boolean

isCellFixed :boolean

Type:
  • boolean

isCellHovered :boolean

Type:
  • boolean

isCellSelected :boolean

Type:
  • boolean

isCellVisible :boolean

"Visible" means scrolled into view.

Type:
  • boolean

isColumnFixed :boolean

Type:
  • boolean

isColumnHovered :boolean

Type:
  • boolean

isColumnSelected :boolean

Type:
  • boolean

isColumnVisible :boolean

"Visible" means scrolled into view.

Type:
  • boolean

isDataCell :boolean

A data cell is a cell in both a data row and a data column.

Type:
  • boolean

isDataColumn :boolean

A data column is any column that is not the row number column or the tree column.

Type:
  • boolean

isDataRow :boolean

A data row is any row in the data subgrid; all other rows (headers, footers, etc.) are not data rows.

Type:
  • boolean

isFilterCell :boolean

Type:
  • boolean

isFilterHandle :boolean

Type:
  • boolean

isFilterRow :boolean

Type:
  • boolean

isHandleCell :boolean

Type:
  • boolean

isHandleColumn :boolean

Type:
  • boolean

isHeaderCell :boolean

Type:
  • boolean

isHeaderHandle :boolean

Type:
  • boolean

isHeaderRow :boolean

Type:
  • boolean

isRowFixed :boolean

Type:
  • boolean

isRowHovered :boolean

Type:
  • boolean

isRowSelected :boolean

Type:
  • boolean

isRowVisible :boolean

"Visible" means scrolled into view.

Type:
  • boolean

isSummaryCell :boolean

Type:
  • boolean

isSummaryHandle :boolean

Type:
  • boolean

isSummaryRow :boolean

Type:
  • boolean

isTopTotalsCell :boolean

Type:
  • boolean

isTopTotalsHandle :boolean

Type:
  • boolean

isTopTotalsRow :boolean

Type:
  • boolean

isTreeColumn :boolean

Type:
  • boolean

subgrid :dataModelAPI

Type:

value

The raw value of the cell, unformatted.

visibleColumn :visibleColumnArray

Type:

visibleRow :visibleRowArray

Type:

Methods

clone(assignopt) → {CellEvent}

Copy self with or without own properties

Parameters:
Name Type Attributes Default Description
assign boolan <optional>
false

Copy the own properties to the clone.

Returns:
Type
CellEvent

getCellProperty(key) → {string}

Parameters:
Name Type Description
key string

Property name.

Returns:

Property value.

Type
string

properties() → {string}

Returns:

Cell properties object if it exists, else the column properties object it would have as a prototype if did exist.

Type
string

resetDataXY(dataX, dataY, subgridopt) → {boolean}

Set up this CellEvent instance to point to the cell at the given data coordinates.

If the requested cell is not be visible (due to being scrolled out of view), the instance is not reset.

Parameters:
Name Type Attributes Default Description
dataX number

Horizontal data cell coordinate.

dataY number

Vertical data cell coordinate.

subgrid dataModelAPI <optional>
this.behavior.subgrids.data
Returns:

Visibility.

Type
boolean

resetGridCY(gridC, gridY) → {boolean}

If the requested cell is not be visible (due to being scrolled out of view or outside the bounds of the rendered grid), the instance is not reset.

Parameters:
Name Type Description
gridC number

Horizontal grid cell coordinate adjusted for horizontal scrolling after fixed columns.

gridY number

Raw vertical grid cell coordinate.

Returns:

Visibility.

Type
boolean

resetGridXDataY(gridX, dataY, subgridopt, useAllCellsopt) → {boolean}

If the requested cell is not be visible (due to being scrolled out of view or outside the bounds of the rendered grid), the instance is not reset.

Parameters:
Name Type Attributes Default Description
gridX number

Horizontal grid cell coordinate (adjusted for horizontal scrolling after fixed columns).

dataY number

Vertical data cell coordinate.

subgrid dataModelAPI <optional>
this.behavior.subgrids.data
useAllCells boolean <optional>

Search in all rows and columns instead of only rendered ones.

Returns:

Visibility.

Type
boolean

resetGridXY(gridX, gridY) → {boolean}

If the requested cell is not be visible (due to being scrolled out of view or outside the bounds of the rendered grid), the instance is not reset.

Parameters:
Name Type Description
gridX number

Raw horizontal grid cell coordinate.

gridY number

Raw vertical grid cell coordinate.

Returns:

Visibility.

Type
boolean

setCellProperty(key, value)

Parameters:
Name Type Description
key string

Property name.

value string

Property value.