Skip to content

ColumnSummary

See the Column summary guide for examples and configuration details.

Options

columnSummary

Can be set at: grid

Source code

columnSummary.columnSummary : Array<object> | function

The columnSummary option configures the ColumnSummary plugin.

You can set the columnSummary option to an array of objects. Each object configures a single column summary, using the following properties:

PropertyPossible valuesDescription
sourceColumnA numberColumn to summarize
rangesAn arrayRanges of rows to summarize
type'sum' | 'min' | 'max' | 'count' | 'average' | 'custom'Summary function
destinationRowA numberDestination cell’s row coordinate
destinationColumnA numberDestination cell’s column coordinate
forceNumerictrue | falseTreat non-numerics as numerics
reversedRowCoordstrue | falseReverse row coordinates
suppressDataTypeErrorstrue | falseSuppress data type errors
readOnlytrue | falseMake summary cell read-only
roundFloattrue | false | A numberRound summary result
includeSummaryResultstrue | falseInclude other summary results
customFunctionA functionCustom summary function

Read more:

This option can only be set at the grid level. It has no effect when set in the columns, cells, or cell options.

Default: undefined
Example

columnSummary: [
{
sourceColumn: 0,
ranges: [
[0, 2], [4], [6, 8]
],
type: 'custom',
destinationRow: 4,
destinationColumn: 1,
forceNumeric: true,
reversedRowCoords: true,
suppressDataTypeErrors: false,
readOnly: true,
roundFloat: false,
customFunction(endpoint) {
return 100;
}
}
],

Members

LICENSE

Source code

ColumnSummary.LICENSE

Returns the license token of the plugin, its display name, where it is checked, and the tokens it requires.

PLUGIN_KEY

Source code

ColumnSummary.PLUGIN_KEY

Returns the plugin key used to identify this plugin in Handsontable settings.

PLUGIN_PRIORITY

Source code

ColumnSummary.PLUGIN_PRIORITY

Returns the priority order used to determine the order in which plugins are initialized.

Methods

disablePlugin

Source code

columnSummary.disablePlugin()

Disables the plugin functionality for this Handsontable instance.

When the settings turn the plugin off (not the disable step of updatePlugin()), the data the grid holds gets its destination values back, so it sums the same input when the plugin comes back.

enablePlugin

Source code

columnSummary.enablePlugin()

Enables the plugin functionality for this Handsontable instance.

isEnabled

Source code

columnSummary.isEnabled() ⇒ boolean

Checks if the plugin is enabled in the handsontable settings. This method is executed in Hooks#beforeInit hook and if it returns true then the ColumnSummary#enablePlugin method is called.

updatePlugin

Source code

columnSummary.updatePlugin()

Updates the plugin’s state.

This method is executed when updateSettings() is invoked with any of the following configuration options:

The endpoints are computed in the ready step, once the call returns and the data is loaded. While core applies the settings ahead of their data (isDataWorkDeferred()), onDataReady() computes them.