JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://unpkg.com/tabulator-tables@6.2.0/dist/js/tabulator.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/tabulator-tables@6.2.0/dist/css/tabulator.min.css">
<div id="table"></div>
JavaScript
var tableData = [
{name:"qwerty", subtable: [{name: "single line value"}]}
];
function childTableCellFormatter(cell) {
if(cell.getData().loaded) {
return cell.getValue();
}
setTimeout(() => {
cell.getRow().update({name: "multi line <br> value", loaded: true})
}, 1000);
return cell.getValue();
}
function rowFormatter(row) {
var holderEl = document.createElement("div");
holderEl.style.paddingLeft = "20px";
row.getElement().appendChild(holderEl);
var subtable = new Tabulator(holderEl, {
layout: 'fitDataFill',
data: row.getData().subtable,
columns: [ {title:"Name", field:"name", formatter: childTableCellFormatter }]
});
subtable.on("tableBuilt", () => table.redraw());
}
var table = new Tabulator("#table", {
layout: 'fitDataFill',
data: tableData,
columns: [ {title:"Name", field:"name"}],
rowFormatter: rowFormatter
});