Handsontable example

by handsoncode

HTML

<script src="https://docs.handsontable.com/pro/1.11.0-beta1/bower_components/numbro/dist/languages.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.css">
<script src="https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.js"></script>
<div id="example1" class="hot handsontable htColumnHeaders"></div>

CSS

body {
  background: #FFF;
  padding: 0;
  margin: 0;
  font-size: 0.8em
}

JavaScript

var
  container = document.getElementById('example1'),
  hot;

hot = new Handsontable(container, {
  data: Handsontable.helper.createSpreadsheetData(8, 2),
  colHeaders: true,
  colWidths: 378,
  licenseKey: 'non-commercial-and-evaluation',
});

hot.updateSettings({
  cells: function(row, col) {
    var cellProperties = {};

    if (row === 0) {
      cellProperties.type = 'date'
    } else if (row === 2) {
      cellProperties.editor = Handsontable.editors.TextEditor;
      cellProperties.renderer = Handsontable.renderers.PasswordRenderer
    }
    return cellProperties
  }
})

hot.validateCells();