Handsontable example
HTML
<div id="example1" class="hot handsontable htColumnHeaders"></div>
CSS
</style><!-- Ugly Hack due to jsFiddle issue -->
<script src="https://docs.handsontable.com/pro/4.0.0/components/handsontable-pro/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://docs.handsontable.com/pro/4.0.0/components/handsontable-pro/dist/handsontable.full.min.css">
<script src="https://docs.handsontable.com/pro/4.0.0/components/numbro/dist/languages.min.js"></script>
JavaScript
var
container = document.getElementById('example1'),
hot;
hot = new Handsontable(container, {
fixedRowsTop: 1,
minRows: 2,
minCols: 2,
startRows: 11,
startCols: 6,
wordWrap: true,
rowHeaders: function (i) {
if (i === 0) {
return ""
} else {
return i
}
},
stretchH: 'all',
height: 255,
width: 550,
colWidths:50,
cells: function (row, col, prop) {
var cellProperties = {};
if (row === 0) {
cellProperties.renderer = firstRowRenderer; // uses function directly
}
return cellProperties;
}
});
function firstRowRenderer(instance, td, row, col, prop, value, cellProperties) {
Handsontable.renderers.TextRenderer.apply(this, arguments);
td.style.fontWeight = 'bold';
td.style.color = '#000000';
td.style.background = '#EEE';
}
var cols = hot.countCols();
for (var i = 0; i < cols; i++) {
hot.setDataAtCell(0, i, "Header");
}