JSFiddle - React, Tailwind, and code Playground
by axl163
HTML
<div>
<div id="example1" class="hot handsontable htRowHeaders htColumnHeaders"></div>
</div>
CSS
</style><!-- Ugly Hack due to jsFiddle issue -->
<script src="https://handsontable.github.io/handsontable-ruleJS/lib/jquery/jquery-1.10.2.js"></script>
<script src="https://handsontable.github.io/handsontable-ruleJS/lib/handsontable/handsontable.full.js"></script>
<script src="https://handsontable.github.io/handsontable-ruleJS/lib/RuleJS/lib/formulajs/formula.js"></script>
<script src="https://handsontable.github.io/handsontable-ruleJS/lib/RuleJS/js/parser.js"></script>
<script src="https://handsontable.github.io/handsontable-ruleJS/lib/RuleJS/js/ruleJS.js"></script>
<script src="https://handsontable.github.io/handsontable-ruleJS/lib/handsontable/handsontable.formula.js"></script>
<link type="text/css" rel="stylesheet" href="https://docs.handsontable.com/pro/1.8.0/bower_components/handsontable-pro/dist/handsontable.full.min.css">
JavaScript
document.addEventListener("DOMContentLoaded", function() {
var data = [
[0, "Bill", 70, '=B1'],
[1, "Amy", 24, '=B2'],
[2, "Sandy", 40, '=B3'],
[3, "Carlos", 15, '=B4'],
[4, "Ryan", 22, '=SUM(A4,2,3)']
];
var example1 = document.getElementById('example1');
var hot1 = new Handsontable(example1, {
data: data,
colHeaders: true,
rowHeaders: true,
contextMenu: true,
formulas: true,
columnSorting: true
});
function bindDumpButton() {
if (typeof Handsontable === "undefined") {
return;
}
Handsontable.Dom.addEvent(document.body, 'click', function (e) {
var element = e.target || e.srcElement;
if (element.nodeName == "BUTTON" && element.name == 'dump') {
var name = element.getAttribute('data-dump');
var instance = element.getAttribute('data-instance');
var hot = window[instance];
console.log('data of ' + name, hot.getData());
}
});
}
bindDumpButton();
});