Handsontable example

by handsoncode

HTML

<div id="example1" class="hot handsontable htRowHeaders htColumnHeaders" style="height: 320px; overflow: hidden; width: 100%;" data-originalstyle="height: 320px; overflow: hidden; width: 100%;"></div>

CSS

</style><!-- Ugly Hack due to jsFiddle issue -->

<script src="https://cdn.jsdelivr.net/npm/handsontable@7.0.2/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable@7.0.2/dist/handsontable.full.min.css">

JavaScript

var example = document.getElementById('example1');
  var hot1 = new Handsontable(example, {
    data: Handsontable.helper.createSpreadsheetData(1000, 1000),
    colWidths: 100,
    width: '100%',
    height: 320,
    rowHeights: 23,
    rowHeaders: true,
    colHeaders: true,
    editor: false,
    cells: function(row, col){
    	var cp = {}
      if(col === 0){
      	cp.editor = 'text'
      }
      return cp
    },
    afterSelectionEnd: function(r, c, r2, c2) {
    	var cellProp = this.getCellMeta(r, c);
      console.log(this.getDataAtCell(r,c));
      if (r === r2 && c === c2 && !cellProp.readOnly) {
      	var ed = this.getActiveEditor();
        ed.open();
        ed.refreshValue()
        console.log(ed)
      }
    },
  });