FixedHeader initializes in upper left

FixedHeader initializes in upper left

peterkronenbergpeterkronenberg Posts: 112Questions: 0Answers: 0
edited October 2010 in FixedHeader
Hi Allan,
Datatables is absolutely amazing.. Thank you. I'm having a slight problem with FixedHeader. When it initializes, the cloned header is in the upper left. As soon as I start to scroll, it disappears and everything is fine from that point on.
Here are links to the code as well as a screen shot:
http://dl.dropbox.com/u/4104018/fixedHeaderBug.html
http://dl.dropbox.com/u/4104018/FixedHeaderBug.bmp

Thanks
Peter

Replies

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Hi Peter,

    Thanks for the kind words :-)

    I'm not certain, but I suspect that this is the issue:

    [code]
    // Start hidden
    $('.error').hide();
    $('#mainDiv').hide();
    [/code]
    When the element is hidden, the browser doesn't bother calculating position etc, as an optimisation, so when FixedHeader queries the table for it's position, it will just get '0' for top / left positioning. If you comment those lines out, does it work?

    Allan
  • peterkronenbergpeterkronenberg Posts: 112Questions: 0Answers: 0
    Thanks, that was it. I changed the code so I show() the div before calling FixedHeader.
This discussion has been closed.