Adjusting column headers on first tab
Adjusting column headers on first tab
CrimsonGT
Posts: 7Questions: 4Answers: 0
I was having an issue with column headers not aligning with the body when I switched from pagination to scrollbars (seen in screenshot below). I was able to fix this on all of my tabs by adding the columns.adjust() but the initial tab still has the problem as its only triggered by clicking tabs. Where can I add this so that the columns adjustment is applied to the initial table as well?
http://i.stack.imgur.com/xZPPm.png
<script>
$(document).ready(function()
{
$('a[data-toggle="tab"]').on( 'shown.bs.tab', function (e) {
//$.fn.dataTable.tables( {visible: true, api: true} ).columns.adjust();
$( $.fn.dataTable.tables( true ) ).DataTable().columns.adjust();
} );
$('table.table').DataTable({
responsive: true,
"order": [[ 7, "desc" ]],
"scrollY": "500px",
"scrollCollapse": true,
"paging": false,
"bInfo" : false
});
$('#dt-players-qb').DataTable().search( '' ).draw();
});
</script>
This discussion has been closed.
Answers
Also curious if there is a way to move the search bar to the left and above the tabs rather than below? I am reading over the page about sdom but haven't been able to figure out how to use it yet.