Handsontable example
by handsoncode
HTML
<div>
<div id="hot"></div>
</div>
CSS
</style><!-- Ugly Hack due to jsFiddle issue --> <script src="https://docs.handsontable.com/pro/1.10.1/bower_components/handsontable-pro/dist/handsontable.full.min.js"></script> <link type="text/css" rel="stylesheet" href="https://docs.handsontable.com/pro/1.10.1/bower_components/handsontable-pro/dist/handsontable.full.min.css"> <style> .test,
.test2 {
border: 0;
color: #FFF;
padding: 0.4em
}
.test {
background: #651FFF;
}
.test2 {
background: #F50057;
}
JavaScript
document.addEventListener("DOMContentLoaded", function() {
// var dataObject = Model.getJSMetaData;
var hotElement = document.querySelector('#hot');
//var hotElementContainer = hotElement.parentNode;
var hotSettings = {
//data: dataObject,
data: Handsontable.helper.createSpreadsheetData(10, 10),
colHeaders: ['AssetId', 'Platform', 'AnotherField'],
columnSorting: {
column: 0
},
sortIndicator: true,
stretchH: 'all',
//width: '100%',
autoWrapRow: true,
//height: '100%',
contextMenu: true,
minSpareRows: 0,
allowInsertRow: false,
allowInsertColumn: false,
//maxRows: 22,
rowHeaders: true,
wordWrap: false,
dropdownMenu: true,
filters: true,
allowRemoveColumn: true,
manualColumnResize: true,
manualRowResize: true,
readOnly: true,
multiSelect: false,
columnSorting: true,
manualColumnMove: true,
//afterOnCellMouseDown: itemSelected
};
var hot = new Handsontable(hotElement, hotSettings);
});