Skip to content

Endpoints

Description

Class used to make all endpoint-related operations.

Description

Initializes the endpoints manager with a reference to the ColumnSummary plugin and the summary endpoint configuration.

Members

currentEndpoint

Source code

endpoints.currentEndpoint : object

The current endpoint (calculation destination point) in question.

Default: null

endpoints

Source code

endpoints.endpoints : Array

Array of declared plugin endpoints (calculation destination points).

Default: {Array} Empty array.

settingsType

Source code

endpoints.settingsType : string

Settings type. Can be either ‘array’ or ‘function’.

Default: ”{‘array’}“

Methods

assignSetting

Source code

endpoints.assignSetting(settings, endpoint, name, defaultValue)

Setter for the internal setting objects.

ParamTypeDescription
settingsobjectObject with the settings.
endpointobjectContains information about the endpoint for the the calculation.
namestringSettings name.
defaultValueobjectDefault value for the settings.

cacheSummaryDestinations

Source code

endpoints.cacheSummaryDestinations(endpoints)

Records the destinations of the endpoints a refresh pass is about to calculate.

The resolved endpoints are passed in rather than read through getAllEndpoints(), which would re-invoke a settings function and could describe a different layout than the pass is working on.

ParamTypeDescription
endpointsArray<object>The endpoints the current pass will calculate.

countAddressableRows

Source code

endpoints.countAddressableRows() ⇒ number

Returns the number of rows an endpoint may address, that is the physical row count capped by maxRows. Used for the settings defaults that need a row count rather than a bounds check.

maxRows is normalized the same way DataMap#getLength does it: 0 or less means zero rows, anything falsy means no cap.

countPhysicalRows

Source code

endpoints.countPhysicalRows() ⇒ number

Returns the number of physical rows the dataset holds, ignoring trimming.

Endpoint destination rows and calculation ranges are physical indexes, so they must never be compared against countRows() - that counts only the visible rows and shrinks whenever a plugin trims rows (NestedRows collapsing a group, TrimRows, the Filters plugin).

getAllEndpoints

Source code

endpoints.getAllEndpoints() ⇒ Array

Get an array with all the endpoints.

getEndpoint

Source code

endpoints.getEndpoint(index) ⇒ object

Get a single endpoint object.

ParamTypeDescription
indexnumberIndex of the endpoint.

initEndpoints

Source code

endpoints.initEndpoints()

Initialize the endpoints provided in the settings.

isEndpointOutOfBounds

Source code

endpoints.isEndpointOutOfBounds(endpoint, [rowOffset], [colOffset]) ⇒ boolean

Checks whether an endpoint points outside the table.

A trimmed destination row is not out of bounds - the row exists, it is only hidden - so it is deliberately not reported here. A row that is visible but sits past maxRows is out of bounds, because the grid renders no cell for it.

ParamTypeDefaultDescription
endpointobjectContains the endpoint information.
[rowOffset]number0optional Row offset to apply before the check.
[colOffset]number0optional Column offset to apply before the check.

isSummaryDestination

Source code

endpoints.isSummaryDestination(physicalRow, column) ⇒ boolean

Checks whether a physical cell holds the result of an endpoint.

getCellValue normally recognizes a result by its columnSummaryResult class, but cell meta is addressed by visual coordinates, so a trimmed row has no readable class. Without this check a hidden summary row is summed as if it were plain data and inflates every summary covering it.

ParamTypeDescription
physicalRownumberPhysical row index.
columnnumberColumn index.

parseSettings

Source code

endpoints.parseSettings(settings) ⇒ Array<object>

Parse plugin’s settings.

ParamTypeDescription
settingsArrayThe settings array.

refreshAllEndpoints

Source code

endpoints.refreshAllEndpoints()

Calculate and refresh all defined endpoints.

refreshCellMetas

Source code

endpoints.refreshCellMetas()

Refreshes the cell meta information for the all endpoints after the updateSettings method call which in some cases (call with columns option) can reset the cell metas to the initial state.

refreshChangedEndpoints

Source code

endpoints.refreshChangedEndpoints(changes)

Calculate and refresh endpoints only in the changed columns.

ParamTypeDescription
changesArrayArray of changes from the afterChange hook.

refreshEndpoint

Source code

endpoints.refreshEndpoint(endpoint)

Calculate and refresh a single endpoint.

ParamTypeDescription
endpointobjectContains the endpoint information.

refreshEndpointsBySourceColumns

Source code

endpoints.refreshEndpointsBySourceColumns(visualColumns)

Calculate and refresh endpoints whose sourceColumn (visual) matches any of the provided columns.

ParamTypeDescription
visualColumnsSet<number>
Array<number>
Visual column indexes to match against.

resetAllEndpoints

Source code

endpoints.resetAllEndpoints([endpoints], [useOffset])

Resets (removes) the endpoints from the table.

ParamTypeDefaultDescription
[endpoints]Arrayoptional Array containing the endpoints.
[useOffset]booleantrueoptional Use the cell offset value.

resetEndpointValue

Source code

endpoints.resetEndpointValue(endpoint, [useOffset])

Reset the endpoint value.

ParamTypeDefaultDescription
endpointobjectContains the endpoint information.
[useOffset]booleantrueoptional Use the cell offset value.

setEndpointValue

Source code

endpoints.setEndpointValue(endpoint, [source], [render])

Set the endpoint value.

ParamTypeDefaultDescription
endpointobjectContains the endpoint information.
[source]stringoptional Source of the call information.
[render]booleanfalseoptional true if it needs to render the table afterwards.