Handsontable example

by handsoncode

HTML

<script src="https://docs.handsontable.com/pro/1.18.1/bower_components/handsontable-pro/dist/handsontable.full.min.js"></script>
<link rel="stylesheet" href="https://docs.handsontable.com/pro/1.18.1/bower_components/handsontable-pro/dist/handsontable.full.min.css">
<h2>First Handsontable</h2>
<div class="example1"></div>
<button class="show">Show it</button>
<div class="wind">
  <h2>Second Handsontable</h2>
  <div class="example2"></div>
  <button class="hide">Hide it</button>
</div>

CSS

.wind {
  visibility: visible;
  position: absolute;
  background: #fff;
  border: 2px solid blue;
  z-index: 90;
  padding: 10px;
  top: 100px;
  left: 50px;
}

JavaScript

var wind = document.querySelector('.wind');
var
  example = document.querySelector('.example1'),
  example2 = document.querySelector('.example2'),
  hot = new Handsontable(example, {
    data: Handsontable.helper.createSpreadsheetData(5, 5),
    colHeaders: true,
    renderer: 'html'
  });

hot2 = new Handsontable(example2, {
  data: Handsontable.helper.createSpreadsheetData(3, 7),
  colHeaders: true,
  renderer: 'html'
});

document.querySelector('.show').addEventListener('click', function(){
wind.style.visibility = 'visible'
});
document.querySelector('.hide').addEventListener('click', function(){
wind.style.visibility = 'hidden'
})