Handsontable example

by sqiudward

HTML

<div id="example2" class="hot handsontable htColumnHeaders"></div>

CSS

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

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

JavaScript

var
    isChecked,
    container2 = document.getElementById('example2'),
    hot2;
  
  hot2 = new Handsontable(container2, {
    
    colHeaders: function (col) {
      var txt;
  
      switch (col) {
        case 0:
          return '<b>Bold</b> and <em>Beautiful</em>';
  
        case 1:
          txt = "Some <input type='checkbox' class='checker' onclick='alert(&quot;hello world&quot;)' ";
          txt += isChecked ? 'checked="checked"' : '';
          txt += "> checkbox";
  
          return txt;
      }
    }
  });