Reputation: 171351
I would like to display to user a table which contains ~500,000 rows. The table should be calculated based on a file (i.e. the table is known at the beginning, and does not change). I guess that building the HTML text of this table is not a good idea in terms of memory performance. So how can I build such table ?
I would like user to be able to scroll the table using a vertical scroll bar. Is it possible to build on the fly only the visible part of the table ? I'm afraid to see delays because of this.
Is it a better idea to use server side programming rather than Javascript ?
I'm not restricted to any server side programming language, so any advise would be appreciated !
Upvotes: 2
Views: 5827
Reputation: 468
Try this: Clusterize.js Tiny plugin to display large data sets easily https://clusterize.js.org/
Upvotes: 1
Reputation: 5671
Is it possible to build on the fly only the visible part of the table ?
If you build a "fake" scroll (e.g. jquery slider) you can retrieve parts of the table instead of the whole.
Upvotes: 0
Reputation: 171421
Displaying 500,000 rows all at once to a user is a bad idea. Consider other options:
If the users really needs to see all that data at once, then viewing it in the browser is one of the worst ways to do that - they should be using a tool made specifically for viewing data, like Tableau.
Upvotes: 4
Reputation: 449485
This really is a case for server-side pagination, I would say, maybe in combination with Ajax. A HTML table with 500.000 rows is going to crash a lot of browsers.
You're not specifying which server side technology you work with. If you update your question, I'm sure people will be able to give you some pointers.
Upvotes: 2
Reputation: 45721
Send the first 250-ish rows to the user, as he scrolls down, perhaps past row 200, fetch the next 250 rows, append to the table and so on.
This is a (ui) design pattern known as "Infinite scroll".
Upvotes: 7
Reputation: 23244
Classic example of where to use ajax.
Use javascript in combination with a server side script.
Upvotes: 3