Handsontable example
HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/handsontable/handsontable@10.0.0/dist/handsontable.full.css">
<script src="https://cdn.jsdelivr.net/gh/handsontable/handsontable@10.0.0/dist/handsontable.full.js"></script>
<div id="example3"></div>
JavaScript
function getData() {
return [
['', 'Kia', 'Nissan', 'Toyota', 'Honda', 'Mazda', 'Ford'],
['2012', 10, 11, 12, 13, 15, 16],
['2013', 10, 11, 12, 13, 15, 16],
['2014', 10, 11, 12, 13, 15, 16],
['2015', 10, 11, 12, 13, 15, 16],
['2016', 10, 11, 12, 13, 15, 16]
];
}
const example3 = document.getElementById('example3');
let settings3 = {
data: getData(),
licenseKey: 'non-commercial-and-evaluation',
rowHeaders: true,
colHeaders: true,
contextMenu: {
items: {
"make_read_only": {
hidden: function() {
// if first row, disable this option
return hot.getSelectedRangeLast().to.row === 1;
}
},
"copy": {
name: function() {
return 'đź“‹ Cell content into clipboard';
},
callback: function(key, selection, clickEvent) {
const value = this.getDataAtCell(selection[0].start.row, selection[0].start.col);
navigator.clipboard.writeText(value)
}
}
}
}
};
let hot = new Handsontable(example3, settings3);