GridLocation

This class encapsulates a reference to a specific navigable grid location.

This encapsulates a grid cell based upon the record and column, but in addition, it could represent an actionable location within a cell* if the target is not the grid cell in question.

A GridLocation is immutable. That is, once instantiated, the record and column, which it references cannot be changed. The move method returns a new instance.

A GridLocation that encapsulates a cell within the body of a grid will have the following read-only properties:

  • grid : Grid The Grid that owns the GridLocation.
  • record : Model The record of the row that owns the GridLocation. (null if the header).
  • rowIndex : Number The zero-based index of the row that owns the GridLocation. (-1 means the header).
  • column : Column The Column that owns the GridLocation.
  • columnIndex : Number The zero-based index of the column that owns the GridLocation.
  • cell : HTMLElement The referenced cell element.
  • target : HTMLElement The focusable element. This may be the cell, or a child of the cell.

If the location is a column header, the record will be null, and the rowIndex will be -1.

Configs

7

The Column which this GridLocation references. (unless columnIndex or columnId is used to configure)

columnId: String | Number

The column id which this GridLocation references. (unless column or columnIndex is used to configure)

The column index which this GridLocation references. (unless column or columnId is used to configure)

field: String

The field of the column index which this GridLocation references. (unless another column identifier is used to configure)

The grid which this GridLocation references.

The record which this GridLocation references. (unless rowIndex is used to configure)

The row index which this GridLocation references. (unless record is used to configure).

-1 means the header row, in which case the record will be null.

Properties

12
cell: HTMLElementreadonly

The cell DOM element which this GridLocation references.

Yields the Column of this location.

columnIndex: NumberreadonlyAlso a config

Yields the column index of this location.

containsFocus: Booleanreadonly

This property is true if the focus is inside the cell, not on the cell.

The grid which this GridLocation references.

isActionable: Booleanreadonly

This property is true if the focus target is not the cell itself.

isCell: Booleanreadonly

This property is true if this location represents a cell in the grid body.

isColumnHeader: Booleanreadonly

This property is true if this location represents a column header.

isSelectable: Booleanreadonly

Yields true if the cell and row are selectable.

That is if the record is present in the grid's store and it's not a group summary or group header record.

Yields the Model of this location, or null if the location is a column header.

rowIndex: NumberreadonlyAlso a config

Yields the row index of this location.

target: HTMLElementreadonly

The DOM element which encapsulates the focusable target of this GridLocation.

This is usually the cell, but if this is an actionable location, this may be another DOM element within the cell.

Functions

2

Initializes a new GridLocation.

ParameterTypeDescription
locationGridLocationConfig | HTMLElement

A grid location specifier. This may be:

  • An element inside a grid cell or a grid cell.
  • An object identifying a cell location using the following properties:
    • grid
    • record
    • rowIndex
    • column
    • columnIndex

Returns a *new * GridLocation instance having moved from the current location in the mode specified.

ParameterTypeDescription
whereNumber

Where to move from this GridLocation. May be:

  • GridLocation.UP
  • GridLocation.NEXT_CELL
  • GridLocation.DOWN
  • GridLocation.PREV_CELL
  • GridLocation.FIRST_COLUMN
  • GridLocation.LAST_COLUMN
  • GridLocation.FIRST_CELL
  • GridLocation.LAST_CELL
  • GridLocation.PREV_PAGE
  • GridLocation.NEXT_PAGE
Returns: GridLocation -

A GridLocation object encapsulating the target location.