Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82115

Dynamic elements above FixedHeader revisited

$
0
0
I was having the same problem as described in this thread:

http://datatables.net/forums/discussion/10911/dynamic-elements-above-fixedheader-leads-to-chaos-anarchy/p1

I set up my table filter so that it would dynamically show/hide when an icon was clicked, which caused the cloned table headers to get out of sync with the real one. I found a (seemingly) simple way to fix this is to add a line in _fnScrollFixedHeader that hides the cloned header when it's above the table as such:

this._fnUpdateCache( oCache, 'sDisplay', "none", 'display', nTable.style );

And when below or middle, just do the opposite:

this._fnUpdateCache( oCache, 'sDisplay', "block", 'display', nTable.style );

It seems to work pretty well without the need to update for each iteration of a step function as discussed.

Somewhat related, I also found it helpful to call _fnUpdateClones in the scroll event listeners. The particular scenario involved two tables on a single page. When one was update via AJAX a scrollbar appeared on the page causing the cloned header width to not be correct on the other table,. Maybe there is a better way to handle this?

Viewing all articles
Browse latest Browse all 82115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>