I have build a result page for a calculation. It's basically a CSS-grid in a DIV. The grid has three columns. In each column there are tiles (divs) which contain tables (which show the results).
In JavaScript I calculate the result tables and assign them to the tables. There is an outermost div where I set display to "table".
Here is the problem: Some browsers on some computers present a long empty page. At the very end I can see a bit of tables, the rest is clipped.
This may happen at the beginning where build the page or when I replace a table by a newly calculated table.
For now I found an unsatisfying work around: Before any assignments to div.innerHtml I set display of the outermost div to none. After the assignments I set it back to table after a setTimeout of 0.5 sec. Then the page is built properly.
It looks like that after the assignments some time is needed to build the internal DOM structure but I don't know any event to wait for.
Here is the essence of the html structure:
<div style="display: table">
<div style="display: grid; grid-template-areas: 'left center right';">
<div style="grid-area: left">
<div id="result_table0"></div>
<div id="result_table1"></div>
</div>
<div style="grid-area: center">
<div id="result_table2"></div>
<div id="result_table3"></div>
</div>
<div style="grid-area: right">
<div id="result_table4"></div>
<div id="result_table5"></div>
</div>
</div>
</div>
The Javascript assignments of the tables looks similar like that:
// calculation of the table
let my_result_table = '<table><tr><td>xxx</td><td>yyy</td></tr></table>';
// assignment to the div
document.getElementById('result_table0').innerHTML = my_result_table;
Any ideas what's going wrong here?