var data = [
["", "Ford", "Volvo", "Toyota", "Honda"],
["2014", 10, 11, 12, 13],
["2015", 20, 11, 14, 13],
["2016", 30, 15, 12, 13]
];
var container = document.getElementById('example');
var hot = new Handsontable(container, {
data: data,
minSpareRows: 1,
rowHeaders: true,
colHeaders: true,
contextMenu: true
});
hot.addHook('afterSelection', function(row,column){
const selectedCell = hot.getDataAtCell(row,column);
const selectedCol = hot.getDataAtCol(column);
const selectedRow = hot.getDataAtRow(row);
console.log(`selected cell [${row}][${column}] with value [${selectedCell}]`)
console.log(`column values: ${JSON.stringify(selectedCol)}`);
console.log(`row values: ${JSON.stringify(selectedRow)}`)
});