djmartini djmartini - 2 years ago 250
Javascript Question

DataTables plug-in - Display scrollbar below tfoot tag?

I use jQuery DataTables plug-in and

for horizontal scrolling.

Why scroll bar appears above
tag? How to make it appear below footer?

var table = $('#example')
"scrollX": true,
"scrollCollapse": true,
"dom": 'Zlrtip',
"colResize": {
"tableWidthFixed": false,
//"handleWidth": 10,
"resizeCallback": function(column)

"searching": false,
"paging": false,
"info": false,
"deferRender": true,
"sScrollX": "190%"

See JSFiddle example demonstrating the problem.

Answer Source

You need to add the following code to you DataTables initialization options:

"fnInitComplete": function(){
    // Disable TBODY scoll bars
        'overflow': 'hidden',
        'border': '0'

    // Enable TFOOT scoll bars
    $('.dataTables_scrollFoot').css('overflow', 'auto');

    // Sync TFOOT scrolling with TBODY
    $('.dataTables_scrollFoot').on('scroll', function () {

See updated JSFiddle for demonstration.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download