Slow response when the HTML table is big

前端 未结 6 1928
情深已故
情深已故 2020-12-14 17:29

I am using JavaScript to generate a HTML table of 4 columns, but when the table became very large (e.g. more than 1000 rows), the user could face lag between their interacti

6条回答
  •  轮回少年
    2020-12-14 18:09

    if your table has regular columns (without colspan and/or rowspan) you can improve a bit the rendering time applying the table-layout:fixed property:

    MDN: https://developer.mozilla.org/en/CSS/table-layout

    Under the "fixed" layout method, the entire table can be rendered once the first table row has been downloaded and analyzed. This can speed up rendering time over the "automatic" layout method, but subsequent cell content may not fit in the column widths provided.

提交回复
热议问题