This page covers a next version of Handsontable, and is not published yet.

This page covers a non-latest version of Handsontable.

# ColumnSummary

# Description

Allows making pre-defined calculations on the cell values and display the results within Handsontable. See the demo for more information.

Example

const container = document.getElementById('example');
const hot = new Handsontable(container, {
  data: getData(),
  colHeaders: true,
  rowHeaders: true,
  columnSummary: [
    {
      destinationRow: 4,
      destinationColumn: 1,
      type: 'min'
    },
    {
      destinationRow: 0,
      destinationColumn: 3,
      reversedRowCoords: true,
      type: 'max'
    },
    {
      destinationRow: 4,
      destinationColumn: 5,
      type: 'sum',
      forceNumeric: true
    }
  ]
});

# Options

# columnSummary

Source code (opens new window)

columnSummary.columnSummary : Array<object> | function

Allows making pre-defined calculations on the cell values and display the results within Handsontable.

Possible types:

  • 'sum'
  • 'min'
  • 'max'
  • 'count'
  • 'average'
  • 'custom' - add customFunction.

See the demo for more information.

Default: undefined Example

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

# Methods

# disablePlugin

Source code (opens new window)

columnSummary.disablePlugin()

Disables the plugin functionality for this Handsontable instance.

# enablePlugin

Source code (opens new window)

columnSummary.enablePlugin()

Enables the plugin functionality for this Handsontable instance.

# isEnabled

Source code (opens new window)

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 than the ColumnSummary#enablePlugin method is called.

Last Updated: Apr 12, 2024