I am working on a page in a web application with a large table. 12 columns and up to 300 rows in some cases. I find it hard to get a table for rendering in Internet Explorer. I reproduced my difficulties in this bit of test code:
http://jsfiddle.net/dSFz5/
Some tests with IE9 on the Intel Core Core Q8200 with 4 GB of RAM:
50 rows, 12 columns: 432ms
100 rows, 12 columns: 1023ms
200 rows, 12 columns: 2701ms
400 rows, 12 columns: 8107ms
800 rows, 12 columns: 24619ms
Exponentially bad.
I managed to dig up some code that makes the same test pattern MUCH faster in Internet Explorer, but since I use mustache.js templates to render my cells and rows (keeping all the HTML markup from my JavaScript), I canβt use these DOM methods:
http://jsfiddle.net/bgzLG/
Test results:
50 rows, 12 columns: 37ms
100 rows, 12 columns: 72 ms
200 rows, 12 columns: 146ms
400 rows, 12 columns: 324ms
800 rows, 12 columns: 566ms
I cannot build a table block with a block, as in the second example, because with client templates I need to enter the HTML strings returned by the mustache. If you start embedding .innerHTML in there, tank tanks again.
Can someone recommend a way to build a table in a more efficient way compatible with using client templates?
Markup is one way to solve this problem, but I would like to solve the problem myself.
Any suggestions that were highly appreciated!