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
endpoints.currentEndpoint : object
The current endpoint (calculation destination point) in question.
Default: null
endpoints
endpoints.endpoints : Array
Array of declared plugin endpoints (calculation destination points).
Default: {Array} Empty array.
settingsType
endpoints.settingsType : string
Settings type. Can be either ‘array’ or ‘function’.
Default: ”{‘array’}“
Methods
assignSetting
endpoints.assignSetting(settings, endpoint, name, defaultValue)
Setter for the internal setting objects.
| Param | Type | Description |
|---|---|---|
| settings | object | Object with the settings. |
| endpoint | object | Contains information about the endpoint for the the calculation. |
| name | string | Settings name. |
| defaultValue | object | Default value for the settings. |
cacheSummaryDestinations
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.
| Param | Type | Description |
|---|---|---|
| endpoints | Array<object> | The endpoints the current pass will calculate. |
countAddressableRows
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
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
endpoints.getAllEndpoints() ⇒ Array
Get an array with all the endpoints.
getEndpoint
endpoints.getEndpoint(index) ⇒ object
Get a single endpoint object.
| Param | Type | Description |
|---|---|---|
| index | number | Index of the endpoint. |
initEndpoints
endpoints.initEndpoints()
Initialize the endpoints provided in the settings.
isEndpointOutOfBounds
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.
| Param | Type | Default | Description |
|---|---|---|---|
| endpoint | object | Contains the endpoint information. | |
| [rowOffset] | number | 0 | optional Row offset to apply before the check. |
| [colOffset] | number | 0 | optional Column offset to apply before the check. |
isSummaryDestination
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.
| Param | Type | Description |
|---|---|---|
| physicalRow | number | Physical row index. |
| column | number | Column index. |
parseSettings
endpoints.parseSettings(settings) ⇒ Array<object>
Parse plugin’s settings.
| Param | Type | Description |
|---|---|---|
| settings | Array | The settings array. |
refreshAllEndpoints
endpoints.refreshAllEndpoints()
Calculate and refresh all defined endpoints.
refreshCellMetas
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
endpoints.refreshChangedEndpoints(changes)
Calculate and refresh endpoints only in the changed columns.
| Param | Type | Description |
|---|---|---|
| changes | Array | Array of changes from the afterChange hook. |
refreshEndpoint
endpoints.refreshEndpoint(endpoint)
Calculate and refresh a single endpoint.
| Param | Type | Description |
|---|---|---|
| endpoint | object | Contains the endpoint information. |
refreshEndpointsBySourceColumns
endpoints.refreshEndpointsBySourceColumns(visualColumns)
Calculate and refresh endpoints whose sourceColumn (visual) matches any of the provided columns.
| Param | Type | Description |
|---|---|---|
| visualColumns | Set<number> Array<number> | Visual column indexes to match against. |
resetAllEndpoints
endpoints.resetAllEndpoints([endpoints], [useOffset])
Resets (removes) the endpoints from the table.
| Param | Type | Default | Description |
|---|---|---|---|
| [endpoints] | Array | optional Array containing the endpoints. | |
| [useOffset] | boolean | true | optional Use the cell offset value. |
resetEndpointValue
endpoints.resetEndpointValue(endpoint, [useOffset])
Reset the endpoint value.
| Param | Type | Default | Description |
|---|---|---|---|
| endpoint | object | Contains the endpoint information. | |
| [useOffset] | boolean | true | optional Use the cell offset value. |
setEndpointValue
endpoints.setEndpointValue(endpoint, [source], [render])
Set the endpoint value.
| Param | Type | Default | Description |
|---|---|---|---|
| endpoint | object | Contains the endpoint information. | |
| [source] | string | optional Source of the call information. | |
| [render] | boolean | false | optional true if it needs to render the table afterwards. |