Slow response when the HTML table is big

前端 未结 6 1956
情深已故
情深已故 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:10

    Tables have to be downloaded and render in full before they are displayed, appearing to take a longer to display. This lapse all depends on processing power:

    Are large html tables slow?

    For the amount of rows you have I'm surprised you are seeing any noticeable lag, though you can try a few things from here, to help us help you out:

    • remove gradient backgrounds (as they are rendered by the browser)
    • paginate form data
    • output form rows in chunks (say, 200 rows at a time)
    • does removing all css help?
    • specify a exact width + height on table rows, cells

提交回复
热议问题