Handsontable example

by galvakojis

HTML

<div id="example5" 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
    nestedObjects = [
      {id: 1, name: {first: "Ted", last: "Right"}, address: ""},
      {id: 2, address: ""}, // HOT will create missing properties on demand
      {id: 3, name: {first: "Joan", last: "Well"}, address: ""}
    ],
    container5 = document.getElementById('example5'),
    hot5;
  
  hot5 = new Handsontable(container5, {
    data: nestedObjects,
    colHeaders: true,
    columns: [
      {data: 'id'},
      {data: 'name.first'},
      {data: 'name.last'},
      {data: 'address'}
    ],
    minSpareRows: 1
  });

console.log(hot5.getData())
console.log(hot5.getColHeader())
console.log(hot5)