Handsontable Basic Example (100x10)
HTML
<script src="https://handsontable.com/bower_components/handsontable/dist/handsontable.full.js"></script>
<link rel="stylesheet" href="https://handsontable.com/bower_components/handsontable/dist/handsontable.full.css">
<h2>Handsontable Basic Example (100x10)</h2>
<button onclick="render();">
Render
</button>
<p>
Head to <a href="https://handsontable.com" target="_blank">handsontable.com</a> to learn more about Handsontable.
</p>
<div id="example"></div>
CSS
body {
margin: 20px 30px;
font-size: 13px;
font-family: 'Open Sans', Helvetica, Arial;
}
a {
color: #34A9DC;
text-decoration: none;
}
p {
margin: 5px 0 20px;
}
h2 {
margin: 20px 0 0;
font-size: 18px;
font-weight: normal;
}
JavaScript
var data = function () {
return Handsontable.helper.createSpreadsheetData(100, 10);
};
var init = false;
var container = document.getElementById('example');
function render () {hot.render();}
var hot = new Handsontable(container, {
data: data(),
minSpareCols: 1,
minSpareRows: 1,
rowHeaders: true,
colHeaders: true,
contextMenu: true,
afterInit: function() {
init = true;
},
afterCreateRow: function (index) {
if(init) {
this.setDataAtCell(index, 0, "Test");
this.setCellMeta(index, 0, "bold", true);
}
},
afterRenderer: function (td, row, col) {
if(this.getCellMeta(row,col).bold) {
td.style.fontWeight = "bold";
console.log(row);
}
}
});