JavaScript Data GridColumn menu

Display a configurable dropdown menu, triggered by clicking on a button in a column header.

Overview

The DropdownMenu plugin enables you to add a configurable dropdown menu to the table's column headers. The dropdown menu acts like the context menu but is triggered by clicking the button in the header.

Quick setup

To enable the plugin, set the dropdownMenu configuration option to true when initializing Handsontable.

import Handsontable from 'handsontable';
import 'handsontable/dist/handsontable.full.min.css';

const container = document.querySelector('#example1');

new Handsontable(container, {
  data: [
    ['A1', 'B1', 'C1', 'D1', 'E1', 'F1', 'G1'],
    ['A2', 'B2', 'C2', 'D2', 'E2', 'F2', 'G2'],
    ['A3', 'B3', 'C3', 'D3', 'E3', 'F3', 'G3'],
  ],
  colHeaders: true,
  dropdownMenu: true,
  height: 'auto',
  autoWrapRow: true,
  autoWrapCol: true,
  licenseKey: 'non-commercial-and-evaluation',
});

Plugin configuration

To use the default dropdown contents, set it to true, or to customize it by setting it to use a custom list of actions. For the available entry options reference, see the Context Menu demo.

import Handsontable from 'handsontable';
import 'handsontable/dist/handsontable.full.min.css';

const container = document.querySelector('#example2');

new Handsontable(container, {
  data: [
    ['A1', 'B1', 'C1', 'D1', 'E1', 'F1', 'G1'],
    ['A2', 'B2', 'C2', 'D2', 'E2', 'F2', 'G2'],
    ['A3', 'B3', 'C3', 'D3', 'E3', 'F3', 'G3'],
  ],
  colHeaders: true,
  licenseKey: 'non-commercial-and-evaluation',
  height: 'auto',
  dropdownMenu: [
    'remove_col',
    '---------',
    'make_read_only',
    '---------',
    'alignment',
  ],
  autoWrapRow: true,
  autoWrapCol: true,
});

Windows macOS Action Excel Sheets
Shift+Alt+ Shift+Option+ Open the column menu. Works in any cell, if the respective column header displays the menu button.
Shift+Enter Shift+Enter Open the column menu. Works only when you're selecting a column header that displays the column menu button.

There is a newer version of Handsontable available. Switch to the latest version ⟶