Modified FixedHeader code very slow in IE

Modified FixedHeader code very slow in IE

WodinWodin Posts: 17Questions: 0Answers: 0
edited March 2012 in FixedHeader
Hi

I've been trying to get a modified FixedHeader to work properly with two frozen left columns and also with the top left cells frozen, but my lack of experience with Javascript and exactly how the browsers lay things out/size things is not helping.

The main trouble was getting the alignment right, because the browser seemed to ignore my attempts to set the sizes of various cells in the cloned tables. Even when I tried manually using Firebug.

Someone else has been helping with this and my understanding of what they have done is they have cloned the whole table (instead of just the parts that need to be frozen) and then set the containing DIV to the correct size and set the overflow to not display.

This works, and does not seem to require fiddling with the sizes of the cells of the cloned tables, but in IE the result is really slow for e.g. a table with over 100 rows and a few tens of columns, causing the browser to freeze for over half a minute when "new FixedHeader(...)" is called.

I am not sure if this slowness is directly caused by the way the tables are cloned, or if this is just because IE is slow. Is the slowness likely because of cloning the full table three times?

Thanks.

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    edited March 2012
    > if this is just because IE is slow

    This - however, not so much the cloning operation but the height matching I would be willing to bet. That is horribly slow in IE. You could try removing that from your code and seeing row height by CSS (which is an option in FixedColumns: http://datatables.net/release-datatables/extras/FixedColumns/css_size.html ) - you might be able to do the same thing in FixedHeader.

    *edit* - Thinking about it a bit more, likely the cloning operation isn't going to be quick IE either. Would be interesting to see how fast it is to do the clone but no height / width matching...

    Allan
  • WodinWodin Posts: 17Questions: 0Answers: 0
    Thanks for the suggestions.

    It seems that most of the time is spent getting/setting the widths in _fnCloneThead and _fnCloneTopLeft (mine, but based on the former).

    Since all except the first two columns are supposed to be the same width anyway, it seems we should be able to cut that right down.

    Maybe we can get the widths of only the first three columns and then set the widths of everything by CSS. Will see if that works.
This discussion has been closed.