Handsontable example

by handsoncode

HTML

<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" /> 

<div id="example1" class="hot "></div>

CSS

.rotation {
  transform: rotate(30deg);
  margin: 30px 0 0 40px;
}

JavaScript

const container = document.querySelector('#example1');

function customRenderer(hotInstance, td, row, column, prop, value, cellProperties) {
  Handsontable.renderers.BaseRenderer.apply(this, arguments);

  td.innerHTML = `<p class="rotation">${value}</p>`
}

const hot = new Handsontable(container, {
  data: Handsontable.helper.createSpreadsheetData(3, 5),
  colHeaders: true,
  rowHeaders: true,
  rowHeights: 50,
  colWidths: 120,
  licenseKey: 'non-commercial-and-evaluation',
  columns: [{
      renderer: customRenderer
    },
    {}, {}
  ]
});