views:

35

answers:

1

Hello Gurus:

I have a huge table, 1 row with around 2600 columns (it's a Gantt chart)

What I'm trying to do is to clone this table and copy it 100 times to somewhere on the page (instead of redraw the table 100 times as it seems to be less efficient, I can be wrong though)

var $templateTable = $("div#GTT_TLayout").clone();
//there are 100 divs matching it
$("div[id ^= 'taskgrid_bar_' ]").each(function(){  
    ...
    $(this).before($templateTable.html());
});

The issue is that some customers experience this "script time out" issue.

So the question I have is, is there a better way to do this that is more efficient?

Thanks a lot

A: 

You might as well do the .html() call on the $templateTable outside of the .each since there is no point in calling that 100 times. That should help a little anyways.

amurra
Good point @amurra. Tried it out, improved a little, still cause issues depending on the pc. :(
Liming