Dynamic elements above FixedHeader leads to chaos, anarchy!
Dynamic elements above FixedHeader leads to chaos, anarchy!
As stated in the title, I have a dynamic collapsible element above my DataTable which has a FixedHeader. I figured out I needed to call fnUpdate() after my animations ended, and I did so thusly:
[code]
$('#filters').on('hidden', function () {
ticketHeader.fnUpdate();
});
$('#filters').on('shown', function () {
ticketHeader.fnUpdate();
});
[/code]
It seems to properly update the position of the header, but it is not redrawn until the page is scrolled or resized. As a result, the former (and no longer appropriate) position of the FixedHeader is intact until I scroll the page a bit. At that point, the old header pops out of existence, and the correct header functions properly. Any ideas?
[code]
$('#filters').on('hidden', function () {
ticketHeader.fnUpdate();
});
$('#filters').on('shown', function () {
ticketHeader.fnUpdate();
});
[/code]
It seems to properly update the position of the header, but it is not redrawn until the page is scrolled or resized. As a result, the former (and no longer appropriate) position of the FixedHeader is intact until I scroll the page a bit. At that point, the old header pops out of existence, and the correct header functions properly. Any ideas?
This discussion has been closed.
Replies
http://live.datatables.net/#javascript,html,live
http://raddevon.dyndns.tv:8000/ticket/
Click the More link next to the filter input and watch the magic.
'hidden' and 'shown' are not valid events:-
http://www.w3.org/TR/DOM-Level-3-Events/#event-types-list
Try attaching to the click event for 'more' link instead
I haven't actually used the fixed header plugin myself, however a very similar problem actually appears on the example page for the fixedheader plugin on Chrome (double header, then once you scroll the two header rows re-align):-
http://datatables.net/extras/fixedheader/
http://twitter.github.com/bootstrap/javascript.html#collapse
I see that on the FixedHeader page. Oddly, I didn't have the problem until I added the collapsible element above it.
Thanks to rgvcorley for the help so far.
The real difficulty is in having this work with the animation. If there is a 'step' function that you can use, that might work, but is very heavy handed, since there are a lot of calculations going on that probably don't need to. I've yet to work out a good way of having this work in FixedHeader - DOM mutation events might offer an option, but it will probably be 2020 before we can use that in ball browsers...
Allan
[quote]This event is fired when a collapse element has been made visible to the user (will wait for css transitions to complete).[/quote]
The "hidden" event is predictably similar. It seems like it would be the perfect event for firing fnUpdate.
I'll start my server back up for a few hours in the event you have an opportunity to look at it, Allan.
http://raddevon.dyndns.tv:8000/ticket/
Allan