<div class="data-table">
    <div id="{{ id }}"></div>
</div>

<script>
  (function () {
    var data = {{ data }};

    function heightMaker() {
      return Math.min(
          Math.round({{ scale }} * $(window).height()),
          Math.round(26 * (data.length + 1.5))
      );
    }

    var table = new window.Handsontable($('#{{ id }}')[0], {
      data: data,
      stretchH: 'all',
      height: heightMaker,
      rowHeaders: true,
      colHeaders: [{{column_headers}}],
      manualRowResize: true,
      manualColumnResize: true,
      manualRowMove: true,
      manualColumnMove: true,
      contextMenu: true,
      autoWrapRow: true,
      columnSorting: true,
      copyPaste: true,
      sortIndicator: true,
      autoColumnSize: {samplingRatio: 23},
      manualColumnFreeze: true
    });

  }());
</script>
