Default Handsontable Demo

by igos

HTML

<script src="http://handsontable.com/dist/jquery.handsontable.full.js"></script>
<link rel="stylesheet" href="http://handsontable.com/dist/jquery.handsontable.full.css">
<link rel="stylesheet" href="http://handsontable.com/demo/css/samples.css">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/base/jquery-ui.css">
<h2>Default Handsontable Demo</h2>

<div id="meta" class="dataTable"></div>
<div id="exampleGrid" class="dataTable"></div>

CSS

body {
    background-color: white;
    margin: 20px;
}
h2 {
    margin: 20px 0;
}

JavaScript

var greenRenderer = function (instance, td, row, col, prop, value, cellProperties) {
  Handsontable.TextCell.renderer.apply(this, arguments);
  $(td).css({
    background: 'green'
  });
};

var myData = [
    ["", "Kia", "Nissan", "Toyota", "Honda"],
    ["2008", 10, 11, 12, 13],
    ["2009", 20, 11, 14, 13],
    ["2010", 30, 15, 12, 13]
];

$("#exampleGrid").handsontable({
    data: myData,
    startRows: 5,
    startCols: 5,
    minSpareCols: 1,
    //always keep at least 1 spare row at the right
    minSpareRows: 1,
    //always keep at least 1 spare row at the bottom,
    rowHeaders: false,
    colHeaders: false,
    contextMenu: true
});