FixedHeaders crossing pages?
FixedHeaders crossing pages?
Hi,
I'm using FixedHeaders on several different pages of a Rails/Bootstrap app and as I navigate around the site and scroll over tables the fixed headers for other pages start appearing. You can look at gitstats.hopto.org to see the behaviour.
I have given every table a unique ID and init each table with:
$(document).ready(function(){
$('#<%= locals[:table_name] %>').DataTable({
fixedHeader: true,
bInfo : false,
colReorder: true,
rowReorder: true,
responsive: true,
"bPaginate": false
});
});
Each table is defined as:
<
table id="open_repo_prs" class="table table-condensed table-striped" width="100%">
(with a different id for each of course)
How can fixed headers transcend page loads?
I tried reverting to previous versions of fixedheader (back to 3.0.0) to see if it was a new behaviour, but no change.
I've read various reports about enabling/disabling fixed headers as part of a single page app as divs are hidden etc - but here the page is entirely reloading and I don't think I should need to manually control their appearance.
I must be doing something that is causing datatables or fixedheader state to be persisted across pages - I'd appreciate any guidance on this - they work great, but exhibit this oddness occasionally.
Cheers
Dave
Answers
I believe this was related to the use of Rails Turbolinks. I turned them off and the behaviour no longer seemed to occur.
The better solution was to use the jquery-turbolinks gem