JSFiddle - React, Tailwind, and code Playground
HTML
<div id="tables_data" style="padding:0px;">
<div id="inline_tables" class="div_inline" style="width: 100%!important;">
</div>
</div>
CSS
#tables_data {
margin-left: 13px;
height: 395px;
margin-top: 50px;
margin-right: 25px;
margin-bottom: 1px;
}
</style><script src="https://docs.handsontable.com/pro/1.3.4/bower_components/handsontable-pro/dist/handsontable.full.min.js"></script><link type="text/css" rel="stylesheet" href="https://docs.handsontable.com/pro/1.3.4/bower_components/handsontable-pro/dist/handsontable.full.min.css"><script src="https://docs.handsontable.com/pro/1.3.4/bower_components/numeraljs/languages/de.js"></script>
JavaScript
var container = document.getElementById('inline_tables');
var tables_setting = {
fixedRowsTop: 1,
minRows: 2,
minCols: 2,
startRows: 16,
startCols: 5,
rowHeaders: function(i) {
if (i === 0) {
return ""
} else {
return i
}
},
stretchH: 'all',
height: 375,
width: 550,
cells: function(row, col, prop) {
var cellProperties = {};
if (row === 0) {
cellProperties.renderer = firstRowRenderer; // uses function directly
}
return cellProperties;
}
};
tables_preview = new Handsontable(container, tables_setting);
tables_preview.updateSettings({
contextMenu: {
items: {
"col_left": {},
"col_right": {},
"remove_col": {
disabled: function() {
if (tables_preview.getSelected() != null) {
var cols = tables_preview.countCols();
if (cols == 2) {
if (tables_preview.getSelected()[0][1] === 1) {
return tables_preview.getSelected()[0][1] === 1
} else if (tables_preview.getSelected()[0][1] === 0) {
return tables_preview.getSelected()[0][1] === 0
}
}
}
}
},
"row_above": {
disabled: function() {
// if first row, disable this option
if (tables_preview.getSelected() != null) {
return tables_preview.getSelected()[0][0] === 0;
}
}
},
"row_below": {},
"remove_row": {
disabled: function() {
if (tables_preview.getSelected() != null) {
var row = tables_preview.countRows();
if (row == 2) {
if (tables_preview.getSelected()[0][0] === 1) {
// console.log("1");
return tables_preview.getSelected()[0][0] === 1
} else if...