Global

Members

dataRow :dataRowObject

Type:

visibleColumns :visibleColumnDescriptor

Represents the ordered set of visible columns. Array size is always the exact number of visible columns, the last of which may only be partially visible.

This sequence of elements' columnIndex values assumes one of three patterns. Which pattern is base on the following two questions:

  • Are there "fixed" columns on the left?
  • Is the grid horizontally scrolled?

The set of columnIndex values consists of:

  1. The first element will be -1 if the row handle column is being rendered.
  2. A zero-based list of consecutive of integers representing the fixed columns (if any).
  3. An n-based list of consecutive of integers representing the scrollable columns (where n = number of fixed columns + the number of columns scrolled off to the left).
Type:

visibleRows :visibleRowDescriptor

Represents the ordered set of visible rows. Array size is always the exact number of visible rows.

The sequence of elements' rowIndex values is local to each subgrid.

  • For each non-scrollable subgrid: The sequence is a zero-based list of consecutive integers.
  • For the scrollable subgrid:
    1. A zero-based list of consecutive of integers representing the fixed rows (if any).
    2. An n-based list of consecutive of integers representing the scrollable rows (where n = number of fixed rows + the number of rows scrolled off the top).

Note that non-scrollable subgrids can come both before and after the scrollable subgrid.

Type:

Methods

assignProps(cellEvent)

Overridable for alternative or faster logic.

Parameters:
Name Type Description
cellEvent

cancelEditing() → {boolean}

Cancels editing.

Returns:

Successful. (Cancel is always successful.)

Type
boolean

computeCellsBounds()

This function creates several data structures:

  • Renderer#visibleColumns
  • Renderer#visibleRows

Original comment: "this function computes the grid coordinates used for extremely fast iteration over painting the grid cells. this function is very fast, for thousand rows X 100 columns on a modest machine taking usually 0ms and no more that 3 ms."

This:

deprecated(methodName, dotProps, since, argsopt, notesopt) → {*}

User is warned and new property is returned or new method is called and the result is returned.

Parameters:
Name Type Attributes Description
methodName string

Warning key paired with arbitrary warning in dotProps OR deprecated method name with parentheses containing optional argument list paired with replacement property or method in dotProps.

dotProps string

Arbitrary warning paired with warning key in methodName OR dot-separated new property name to invoke or method name to call. Method names are indicated by including parentheses with optional argument list. The arguments in each list are drawn from the arguments presented in the methodName parameter.

since string

Version in which the name was deprecated.

args Arguments | Array <optional>

The actual arguments in the order listed in methodName. Only needed when arguments need to be forwarded.

notes string <optional>

Notes to add to message.

Returns:

Return value of new property or method call.

Type
*

dispatchEvent(eventName, cancelableopt, event, primitiveEventopt) → {undefined|boolean}

Parameters:
Name Type Attributes Default Description
eventName string
cancelable boolean <optional>
false
event object
primitiveEvent CellEvent | MouseEvent | KeyboardEvent | object <optional>
Returns:
Type
undefined | boolean

errorEffectEnd(erroropt)

This function expects to be passed an error. There is no point in calling this function if there is no error. Nevertheless, if called with a falsy error, returns without doing anything.

This:
Parameters:
Name Type Attributes Description
error boolean | string | Error <optional>

factory(grid) → {CellEvent}

Create a custom CellEvent class.

Create a custom definition of CellEvent for each grid instance, setting the grid, behavior, and dataModel properties on the prototype. As this happens once per grid instantiation, it avoids having to perform this set up work on every CellEvent instantiation.

Parameters:
Name Type Description
grid HyperGrid
Returns:
Type
CellEvent

findCell(colIndexOrCellEvent, rowIndexopt, dataModelopt) → {CellEvent}

Parameters:
Name Type Attributes Default Description
colIndexOrCellEvent number | CellEvent

This is the "data" x coordinate.

rowIndex number <optional>

This is the "data" y coordinate. Omit if colIndexOrCellEvent is a CellEvent.

dataModel dataModelAPI <optional>
this.grid.behavior.dataModel

Omit if colIndexOrCellEvent is a CellEvent.

Returns:

The matching CellEvent object from the renderer's pool. Returns undefined if the requested cell is not currently visible (due to being scrolled out of view).

Type
CellEvent

getActiveColumns(beginopt, endopt)

Parameters:
Name Type Attributes Description
begin number <optional>
end nubmer <optional>
  • @returns {Column[]} A copy of the active columns array by passing the params to Array.prototype.slice.

getColumns(beginopt, endopt)

Parameters:
Name Type Attributes Description
begin number <optional>
end nubmer <optional>
  • @returns {Column[]} A copy of the all columns array by passing the params to Array.prototype.slice.

getMinimumLeftPositionToShowColumn(targetColIdx) → {number}

Calculate the minimum left column index so the target column shows up in viewport (we need to be aware of viewport's width, number of fixed columns and each column's width)

Parameters:
Name Type Description
targetColIdx number

Target column index

Returns:

Minimum left column index so target column shows up

Type
number

getTextWidthTruncated(gc, string, width, truncateTextWithEllipsis, abortopt) → {Object}

Similar to getTextWidth except:

  1. Aborts accumulating when sum exceeds given width.
  2. Returns an object containing both the truncated string and the sum (rather than a number primitive containing the sum alone).
Parameters:
Name Type Attributes Default Description
gc CanvasRenderingContext2D
string string

Text to measure.

width number

Width of target cell; overflow point.

truncateTextWithEllipsis boolean | null | undefined

See module:defaults.truncateTextWithEllipsis.

abort boolean <optional>
false

Abort measuring upon overflow. Returned width sum will reflect truncated string rather than untruncated string. Note that returned string is truncated in either case.

Returns:
  • object.string - undefined if it fits; truncated version of provided string if it does not.
  • object.width - Width of provided string if it fits; width of truncated string if it does not.
Type
Object

getTheme() → {string|undefined|object}

Get registered theme name or unregistered or anonymous theme object.

Returns:

One of:

  • string: When theme name is registered (except 'default').
  • undefined: When theme layer is empty (or theme name is 'default').
  • object: When theme name is not registered.
Type
string | undefined | object

handleKeyDown()

Navigate away from the filter cell when:

  1. Coming from a cell editor (event.detail.editor defined).
  2. The cell editor was for a filter cell.
  3. The key (`event.detail.char) maps (through navKeyMap) to one of:
    • 'UP' or 'DOWN' - Selects first visible data cell under filter cell.
    • 'LEFT' - Opens filter cell editor in previous filterable column; if nonesuch, selects first visible data cell under filter cell.
    • 'RIGHT' - Opens filter cell editor in next filterable column; if nonesuch, selects first visible data cell under filter cell.

initialize()

Currently a synonym for DataSourceOrigin#setData (see).

initialize(optionsopt)

Parameters:
Name Type Attributes Description
options object <optional>

The following options can alternatively be set in the prototype of an extending class.

Properties
Name Type Attributes Default Description
singletons boolean <optional>
false

The registry will consist of singletons which will be instantiated as they are added. (Otherwise the registry consists of constructors which are instantiated later on as needed.)

private boolean <optional>
false

This instance will use a private registry.

initialize(grid, options)

Parameters:
Name Type Attributes Description
grid
options CellEvent

Properties listed below + arbitrary mustache "variables" for merging into template.

options.editPoint Point

Deprecated; use options.gridCell.

options.format string <optional>

Name of a localizer with which to override prototype's localizer property.

rebundleGridRenderers()

Certain renderers that pre-bundle column rects based on columns' background colors need to re-bundle when columns' background colors change. This method sets the rebundle property to true for those renderers that have that property.

registerTheme(themeNameopt)

Parameters:
Name Type Attributes Description
themeName string <optional>

A registry name for the new theme. May be omitted if the theme has an embedded name (in theme.themeName). If omitted, the 2nd parameter (theme) is promoted to first position.

reset(optionsopt)

Parameters:
Name Type Attributes Description
options object <optional>
Properties
Name Type Attributes Description
pipeline object <optional>

Consumed by dataModels.JSON#setPipeline. If omitted, previously established pipeline is reused.

controllers object <optional>

Consumed by dataModels.JSON#setPipeline. If omitted, previously established controllers.

  • @memberOf dataModels.JSON.prototype

resetCellPropertiesCache(xOrCellEvent, yopt, dataModelopt) → {CellEvent}

Resets the cell properties cache in the matching CellEvent object from the renderer's pool. This will insure that a new cell properties object will be known to the renderer. (Normally, the cache is not reset until the pool is updated by the next call to Renderer#computeCellBounds).

Parameters:
Name Type Attributes Default Description
xOrCellEvent number | CellEvent
y number <optional>
dataModel dataModelAPI <optional>
this.grid.behavior.dataModel
Returns:

The matching CellEvent object.

Type
CellEvent

resetRowHeaderColumnWidth(gc, rowCount)

Resize the handle column.

Handle column width is sum of:

  • Width of text the maximum row number, if visible, based on handle column's current font
  • Width of checkbox, if visible
  • Some padding
This:
Parameters:
Name Type Description
gc
rowCount

validateEditorValue() → {boolean|string}

If there is no validator on the localizer, returns falsy (not invalid; possibly valid).

Returns:

Truthy value means invalid. If a string, this will be an error message. If not a string, it merely indicates a generic invalid result.

Type
boolean | string

valOrFunc(column) → {string}

This:
Parameters:
Name Type Description
column
Returns:
Type
string

Type Definitions

CanvasRenderingContext2D

Type:
  • object
See:

columnSchemaObject

Type:
  • object
Properties:
Name Type Attributes Description
name string

The required column name.

header string <optional>

An override for derived header

calculator function <optional>

A function for a computed column. Undefined for normal data columns.

type string <optional>

Used for sorting when and only when comparator not given.

comparator object <optional>

For sorting, both of following required:

Properties
Name Type Description
asc function

ascending comparator

desc function

descending comparator

dataRowObject

Type:
  • object

dataSourcePipelineObject

Type:
  • object
Properties:
Name Type Attributes Description
type string

A "DataSourceOrigin" style constructor name.

options * <optional>

When defined, passed as 2nd argument to constructor.

parent string <optional>

Defines a branch off the main sequence.

paintFunction(gc, config)

This:
Parameters:
Name Type Description
gc CanvasRenderingContext2D
config object
config.bounds Rectangle

The clipping rect of the cell to be rendered.

config.x number

the "translated" index into the behavior.allColumns array

config.normalizedY number

the vertical grid coordinate normalized to first data row

config.untranslatedX number

the horizontal grid coordinate measured from first data column

config.y number

the vertical grid coordinate measured from top header row

pipelineSchema

Describes a new pipeline.

Consists of an ordered list of data source constructors, descendants of DataSourceBase. May contain undefined elements, which are ignored.

Type:
  • Array.<DataSourceBase>

pluginSpec()

One of:

  • simple API - a plain object with an install method
  • object API - an object constructor
  • array:
    • first element is an optional name for the API or the newly instantiated object
    • next element (or first element when not a string) is the simple or object API
    • remaining arguments are optional arguments for the object constructor
  • falsy value such as undefined - ignored

The API may have a name or $$CLASS_NAME property.

Point

See:

propObject

Type:
  • object
Properties:
Name Type Attributes Description
COLUMN object <optional>

If omitted, this is a Global data controller property. If given, both of the following are defined:

Properties
Name Type Attributes Description
index number <optional>

Index of the column in the fields array (the columnIndex parameter to the parsePropOverloads method.

name string <optional>

Name of the column from the fields array.

properties object

The name of the property to get or the values of the properties to set.

Properties
Name Type Attributes Description
GETTER string <optional>

If defined, this is a getter call and this property contains the name of the property value to get; all other defined properties are ignored. If undefined this is setter call.

Rectangle

See:

subgridConstructorRef

Type definition.

One of:

  • function type - Assumed to already be a data model constructor.
  • string type - The name of a data model "class" (constructor) registered in the src/dataModels namespace. Used to look up the constructor in the namespace.

subgridSpec

Type definition.

One of:

  • object type (except when an array) - Assumed to be a reference to an already-instantiated data model. Used as is.
  • 'data' special value - Set to the data subgrid (i.e., the behavior's already-instantiated data model).
  • subgridConstructorRef (see) - The constructor ref is resolved and called with the new keyword + a reference to the grid as the sole parameter.
  • Array object — Accommodates data model constructor arguments. The constructor ref is resolved and called with the new keyword + a reference to the grid as the first parameter + the remaining elements as additional parameters. (If you don't have remaining elements, don't give an array here; just provide a simple subgridConstructorRef instead.) The array should have two or more elements:
    • The first element is a subgridConstructorRef.
    • Remaining elements are used as additional parameters to the constructor.

visibleColumnDescriptor

Type:
  • object
Properties:
Name Type Description
index number

A back reference to the element's array index in Renderer#visibleColumns.

columnIndex number

Dereferences Behavior#columns, the subset of active columns, specifying which column to show in that position.

left number

Pixel coordinate of the left edge of this column, rounded to nearest integer.

right number

Pixel coordinate of the right edge of this column, rounded to nearest integer.

width number

Width of this column in pixels, rounded to nearest integer.

visibleRowDescriptor

Type:
  • object
Properties:
Name Type Description
index number

A back reference to the element's array index in Renderer#visibleRows.

rowIndex number

Local vertical row coordinate within the subgrid to which the row belongs, adjusted for scrolling.

subgrid dataModelAPI

A reference to the subgrid to which the row belongs.

top number

Pixel coordinate of the top edge of this row, rounded to nearest integer.

bottom number

Pixel coordinate of the bottom edge of this row, rounded to nearest integer.

height number

Height of this row in pixels, rounded to nearest integer.