Table

Include Tabulator

Include Tabulator as a table enhancement library:

let fetchStyle = async (url) => { return new Promise((resolve, reject) => { let link = document.createElement('link'); link.type = 'text/css'; link.rel = 'stylesheet'; link.onload = () => resolve(); link.onerror = () => reject(); link.href = url; let headScript = document.querySelector('script'); headScript.parentNode.insertBefore(link, headScript); }); }; eval(await fetch('https://unpkg.com/tabulator-tables/dist/js/tabulator.min.js').then(res => res.text())); await fetchStyle('https://unpkg.com/tabulator-tables/dist/css/tabulator_simple.min.css');

addRowToTable

const addRowToTable = (tableSelector, rowContent) => { const tableRef = document.querySelector(tableSelector).getElementsByTagName('tbody')[0]; const newRow = tableRef.insertRow(tableRef.rows.length); newRow.innerHTML = rowContent; }