Handsontable example

HTML

<div id="example1" class="hot handsontable htRowHeaders htColumnHeaders" style="height: 320px; overflow: hidden; width: 100%;" data-originalstyle="height: 320px; overflow: hidden; width: 100%;"></div>

CSS

</style><!-- Ugly Hack due to jsFiddle issue -->

<script src="https://cdn.jsdelivr.net/npm/handsontable@7.0.3/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable@7.0.3/dist/handsontable.full.min.css">

JavaScript

let example = document.getElementById('example1');
let currentColumn;
let hot1 = new Handsontable(example, {
    data: Handsontable.helper.createSpreadsheetData(1000, 1000),
    colWidths: 100,
    width: '100%',
    height: 320,
    rowHeights: 23,
    columnSorting: true,
    dropdownMenu: {
    	items: {
        do_something: {
          name: 'Do Something',
          callback: (key, selection) => {
            doSomething();
          }
        }
      }
    },
    rowHeaders: true,
    colHeaders: true,
    beforeOnCellMouseDown: (event, coords, element) => {
      // If the target is the dropdownMenu in the column header, save the column.
      if (coords.row < 0 && event.target.className === 'changeType') {
        currentColumn = coords.col;
        event.stopImmediatePropagation();
      }
    },
    afterOnCellMouseDown: (event, coords, element) => {
      if (coords.row < 0 && event.target.className === 'changeType') {
        currentColumn = undefined;
      }
    },
   licenseKey: "non-commercial-and-evaluation"
  });

function doSomething() {
  console.log(`col request (${currentColumn}): action possible`);
  alert(`col request (${currentColumn}): action possible`);
}