Handsontable example
HTML
<div id="example1" ></div>
CSS
</style><!-- Ugly Hack due to jsFiddle issue -->
<script src="https://docs.handsontable.com/pro/1.11.0/bower_components/handsontable-pro/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://docs.handsontable.com/pro/1.11.0/bower_components/handsontable-pro/dist/handsontable.full.min.css"> <style>
button {
margin-bottom: 1em;
}
JavaScript
document.addEventListener("DOMContentLoaded", function() {
var
example = document.getElementById('example1'),
hot;
var theButton = document.getElementById("example1");
theButton.onclick = feedTheButton;
hot = new Handsontable(example,{
data: Handsontable.helper.createSpreadsheetData(5, 5),
stretchH: 'all',
colHeaders: true,
rowHeaders: true
});
function feedTheButton(){
a=hot.getDataAtCell(0,0);
b=hot.getDataAtCell(0,1);
if(a!=0 && b!=0)
{
c="some calculation";
hot.setDataAtCell(0,2,c);
}
else if(a==0 || b==0)
{
hot.setDataAtCell(0,2,0);
}
}
});