Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Render large tables fast with jQuery

I have to dynamically render large tables using JavaScript and jQuery in particular. I am doing this by preparing HTML for the table first and doing append then:

var tableHTML = "<table>...</table>";
$("#container").empty().append(tableHTML);

Is this acceptable way to solve the task and if there faster ways of rendering data?

like image 809
Denis Kulagin Avatar asked Feb 20 '23 08:02

Denis Kulagin


1 Answers

Yes, this is the most efficient way to do that with jQuery. If you wanted to get really fast, you could use bare-bones Javascript:

document.getElementById('container').innerHTML = tableHTML
like image 153
Abraham Avatar answered Feb 28 '23 12:02

Abraham