RowManager

Virtual representation of the grid, using Row to represent rows. Plugs into Grid and exposes the following functions on grid itself:

let row = grid.getRowById(1);

Configs

4
appendRowBuffer: Number= 5

Number of rows to render below current viewport

Set to true to get a small performance boost in applications that uses fixed row height

prependRowBuffer: Number= 5

Number of rows to render above current viewport

Default row height, assigned from Grid at construction (either from config rowHeight or CSS). Can be set from renderers

Properties

8

Calculations

totalHeight: Numberreadonly

Total estimated grid height (used for scroller)

Other

rowOffsetHeight: Numberreadonly

Get actually used row height, which includes any border and might be an average if using variable row height.

Rows

bottomRow: Rowreadonly

Get the Row currently displayed furthest down.

Get the topmost visible Row

Get the last visible Row

Set a fixed row height (can still be overridden by renderers) or get configured row height. Setting refreshes all rows

rows: Row[]readonly

Get all Rows

topRow: Rowreadonly

Get the Row that is currently displayed at top.

Functions

18

Calculations

Returns top and bottom for rendered row or estimated coordinates for unrendered.

ParameterTypeDescription
recordOrIdModel | String | Number

Record or record id

localBoolean

Pass true to get relative record coordinates

roughlyBoolean

Pass true to allow a less exact but cheaper estimate

Returns: Rectangle -

Record bounds with format { x, y, width, height, bottom, right }

Returns top and bottom coordinates for specified row. If all heights are known, by for example using fixed row height, the top is calculated exactly. If not, the top is estimated based on the closest known row.

ParameterTypeDescription
recordIndexNumber

Record index

localBoolean
Returns: Rectangle -

Estimated record bounds

Iteration

Calls a function for each Row

ParameterTypeDescription
fnfunction

Function that will be called with Row as first parameter

Other

Invalidates all cached height and resets averageRowHeight and totalKnownHeight

Get the row at the specified Y coordinate, which is by default viewport-based.

ParameterTypeDescription
yNumber

The Y coordinate to find the Row for.

localBoolean

Pass true if the Y coordinate is local to the SubGrid's element.

Returns: Row -

Found Row or null if no row is rendered at that point.

Invalidate cached height for a record. Removing it from totalKnownHeight and factoring it out of averageRowHeight.

ParameterTypeDescription
recordsModel | Model[]

Refresh a single cell.

ParameterTypeDescription
recordModel

Record for row holding the cell that should be updated

columnIdString | Number

Column id to identify the cell within the row

Returns: Boolean -

Returns true if cell was found and refreshed, false if not

Releases all elements (not from dom), calculates how many are needed, creates those and renders

Rows

Gets the Row following the specified Row (by index or object). Wraps around the end.

ParameterTypeDescription
indexOrRowNumber | Row

index or Row

Returns: Row

Get the Row at a specified store index. Returns undefined if the row index is not rendered.

ParameterTypeDescription
indexNumber
Returns: Row | undefined

Get Row for specified record id

ParameterTypeDescription
recordOrIdModel | String | Number

Record id (or a record)

Returns: Row | null -

Found Row or null if record not rendered

Get a Row for either a record, a record id or an HTMLElement

ParameterTypeDescription
recordOrIdHTMLElement | Model | String | Number

Record or record id or HTMLElement

Returns: Row -

Found Row or null if record not rendered

Get a Row from an HTMLElement

ParameterTypeDescription
elementHTMLElement
Returns: Row | null -

Found Row or null if record not rendered

Scrolling & rendering

Rerender all rows

Renders from specified records row and down (used for example when collapsing a group, does not affect rows above).

ParameterTypeDescription
recordModel

Record of first row to render

Renders from specified row and down (used for example when collapsing a group, does not affect rows above).

ParameterTypeDescription
fromRowRow

First row to render

Renders the passed array (or Set) of rows

ParameterTypeDescription
rowsRow[] | Set

The rows to render

Renders from the top of the grid, also resetting scroll to top. Used for example when collapsing all groups.