Default Handsontable Demo

by secretgspot

HTML

<script src="http://warpech.github.com/jquery-handsontable/jquery.handsontable.js"></script>
<script src="http://warpech.github.com/jquery-handsontable/lib/bootstrap-typeahead.js"></script>
<script src="http://warpech.github.com/jquery-handsontable/lib/jquery.autoresize.js"></script>
<script src="http://warpech.github.com/jquery-handsontable/lib/jQuery-contextMenu/jquery.contextMenu.js"></script>
<script src="http://warpech.github.com/jquery-handsontable/lib/jQuery-contextMenu/jquery.ui.position.js"></script>
<link rel="stylesheet" href="http://warpech.github.com/jquery-handsontable/lib/jQuery-contextMenu/jquery.contextMenu.css">
<link rel="stylesheet" href="http://warpech.github.com/jquery-handsontable/jquery.handsontable.css">
<link rel="stylesheet" href="http://warpech.github.com/jquery-handsontable/demo/css/demo.css">
<h2>Default Handsontable Demo</h2>

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

JavaScript

$("#exampleGrid").handsontable({
    rows: 5,
    cols: 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: true,
    colHeaders: true,
    contextMenu: true
});

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

$("#exampleGrid").handsontable("loadData", data);