Reputation: 685
I am using JSON and PHP to return a very large table 10,000+ records.
The problem I am having is I use innerHTML to append that table to the DOM but this sometimes takes 15 seconds or more and crashes the browser. Is there any solution to optimize this somehow? The table is already pre-built into one string in PHP, so all I have to do is append it.
Upvotes: 2
Views: 917
Reputation: 344585
The best approach would probably be to use a smaller table with pagination (I'm not sure anybody really wants to scroll through 10k+ rows).
Another approach, if you're insistent on having such a large table, might be to break up the HTML into chunks of rows (or even grouped with <tbody>
elements) and then use a timer to append them to a table in the DOM.
Upvotes: 3