Handsontable example
by handsoncode
HTML
<div id="example"></div>
<script src="https://cdn.jsdelivr.net/npm/handsontable@latest/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable@latest/dist/handsontable.full.min.css">
Babel + JSX
function celciusRenderer(instance, td, row, col, prop, value, cellProperties) {
Handsontable.renderers.NumericRenderer.apply(this, [instance, td, row, col, prop, value, cellProperties]);
td.innerHTML = `${value}℃`;
}
const example = document.getElementById('example');
const hot = new Handsontable(example, {
data: [
{ name: 'Population Mercury 1', amplitude: 30 },
{ name: 'Population Mercury 2', amplitude: 33 },
{ name: 'Population Mars 1', amplitude: 20 },
{ name: 'Population Mars 2', amplitude: 24 },
{ name: 'Population Jupiter 1', amplitude: 42 },
],
licenseKey: 'non-commercial-and-evaluation',
rowHeaders: true,
colHeaders: true,
columns: [
{
data: 'name',
title: 'Population name'
},
{
data: 'amplitude',
title: 'Temperature amplitude',
type: 'numeric',
renderer: celciusRenderer,
},
]
});