Skip to content


Duplicate header rows appear when using sScrollx option in datetable

 

In a way less trash way that what I’ve done, you could do something like (if i’ve well understand, ‘DataTables_Table_0′ is the name of your table) :

1
2
3
$('#DataTables_Table_0').on( 'draw.dt' function() {
    $('.dataTables_scrollBody thead tr').addClass('hidden')
}

And do this in the init of your dataTable :

1
2
3
4
5
6
$('#DataTables_Table_0').DataTable( {
    [...], // this is the stuff you already do in init
    "initComplete" : function () {
        $('.dataTables_scrollBody thead tr').addClass('hidden');
    }
});

Guess that should do the tricks for you

Posted in Javascript, datatable. Tagged with , , .