Handsontable example
by Blake Gilchrist
HTML
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/handsontable.full.min.css" />
<script src="https://handsontable.com/docs/scripts/fixer.js"></script>
<div id="example1" class="hot "></div>
Babel + JSX
import Handsontable from 'handsontable';
import 'handsontable/dist/handsontable.full.min.css';
// generate an array of arrays with dummy data
const data = new Array(100) // number of rows
.fill()
.map((_, row) => new Array(50) // number of columns
.fill()
.map((_, column) => `${row}, ${column}`)
);
const container = document.querySelector('#example1');
const hot = new Handsontable(container, {
data,
colWidths: 100,
width: '100%',
contextMenu: true,
height: 320,
rowHeaders: true,
colHeaders: true,
manualColumnFreeze: true,
licenseKey: 'non-commercial-and-evaluation'
});
hot.addHook('afterColumnFreeze', () => {
let htCloneLeft = document.querySelector('.ht_clone_left');
htCloneLeft.style.borderRight = `1px solid #555`;
})
hot.addHook('afterafterColumnUnfreeze', () => {
let htCloneLeft = document.querySelector('.ht_clone_left');
htCloneLeft.style.borderRight = `0px solid #555`;
})