Handsontable example
HTML
<script src="https://cdn.jsdelivr.net/npm/handsontable@12.2/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable@12.2/dist/handsontable.full.min.css" />
<script src="https://handsontable.com/docs/8.3.2/components/numbro/dist/languages.min.js"></script>
<script src="https://handsontable.com/docs/scripts/fixer.js"></script>
<div id="example1" class="hot "></div>
<button class="rm">Remove `className`</button>
SCSS
.handsontable .myCell {
color: pink;
background: grey;
}
Babel + JSX
import Handsontable from 'handsontable';
import 'handsontable/dist/handsontable.full.min.css';
const container = document.querySelector('#example1');
const hot = new Handsontable(container, {
data: Handsontable.helper.createSpreadsheetData(10, 5),
colHeaders: true,
height: 'auto',
licenseKey: 'non-commercial-and-evaluation',
outsideClickDeselects: false
});
hot.batch(() => {
for(let i = 0; i < hot.countRows(); i++){
hot.setCellMeta(i, 0, 'className', 'myCell')
}
hot.render()
})
document.querySelector('.rm').addEventListener('click', function(){
let row = hot.getSelectedLast()[0];
let col = hot.getSelectedLast()[1];
console.log(row, col)
hot.removeCellMeta(row, col, 'className');
hot.render()
})