Handsontable example
HTML
<script src="https://cdn.jsdelivr.net/npm/handsontable@12.0.1/dist/handsontable.full.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable@12.0.1/dist/handsontable.full.css">
<div id="example1" class="hot handsontable htColumnHeaders"></div>
CSS
.handsontable .lastCell {
border-bottom: 1px solid red;
border-left: 1px solid red;
border-right: 1px solid red;
}
.handsontable .middleCell {
border-left: 1px solid red;
border-right: 1px solid red;
}
JavaScript
let cols = [
{
data: 'car'
},
{
data: 'year',
type: 'numeric'
},
{
data: 'price_usd',
type: 'numeric',
numericFormat: {
pattern: '$0,0',
culture: 'en-US'
},
allowEmpty: false
},
{
data: 'price_eur',
type: 'numeric',
numericFormat: {
pattern: {
output: "percent",
mantissa: 0
},
culture: 'de-DE'
}
}
];
function getCarData() {
return Handsontable.helper.createSpreadsheetData(10,10)}
var
container = document.getElementById('example1'),
hot = new Handsontable(container, {
data: getCarData(),
colHeaders: true,
columnSorting : true,
licenseKey: 'non-commercial-and-evaluation',
//columns: cols,
cells: function(row, col, prop){
let cp = {};
return cp
},
cell: [
{row: 0, col: 0, data: 'aaaa', readOnly: true}
]
});
hot.setCellMeta(9, 2, 'className', 'lastCell');
for(var i = 0; i < hot.countRows()-1; i++){
hot.setCellMeta(i, 2, 'className', 'middleCell');
}
hot.render()
/* console.log(cols.length)
cols.push({});
hot.updateSettings({
columns: cols
}) */