Handsontable example
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="example-data-grid" class="hot "></div>
Babel + JSX
import Handsontable from 'handsontable';
import HyperFormula from 'hyperformula';
import 'handsontable/dist/handsontable.full.min.css';
const data = [
[{label: "test"}, '643'],
];
function customRenderer(
instance,
td,
row,
col,
prop,
baseValue,
cellProperties
) {
return Handsontable.renderers.TextRenderer.apply(this, [
instance,
td,
row,
col,
prop,
baseValue.label,
cellProperties,
]);
}
const container = document.querySelector('#example-data-grid');
const hot = new Handsontable(container, {
data: data,
formulas: {
engine: HyperFormula,
},
columns: [
{
type: 'text',
renderer: customRenderer
},
{
type: 'numeric',
renderer: Handsontable.renderers.NumericRenderer
}
],
colHeaders: ['Qty', 'Unit price'],
stretchH: 'all',
height: 500,
licenseKey: 'non-commercial-and-evaluation'
});