3

I have a table on which I am using the DataTables FixedColumns plugin. I'd like for the scroll bar to resize to be only underneath the non-fixed columns, as it is in the example page here: https://datatables.net/release-datatables/extras/FixedColumns/index.html

While using the exact same code, I am unable to make this work. Based on some recommendations in the forums, I switched to the nightly builds of DataTables and FixedColumns, but that has not gotten me anywhere.

Illustration of the problem: http://jsfiddle.net/Ue6Gn/1/

Code:

$(document).ready( function () {
    var oTable = $('#example').dataTable( {
        "sScrollY": "300px",
        "sScrollX": "100%",
    "sScrollXInner": "150%",
        "bScrollCollapse": true,
        "bPaginate": false
    } );

    new $.fn.dataTable.FixedColumns( oTable );
} );

Any ideas?

2 Answers 2

4

Give a background colour to your header, in your case, give white. I faced the same issue. It worked for me.

Sign up to request clarification or add additional context in comments.

1 Comment

Wow... over a year later, somebody rides in with a solution. Incidentally, it looks like you really need to give a background to the whole table, not just the header. Nevertheless, this is the solution.
-1

You need to provide the appropriate DataTables CSS files in your html resources.

<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.1/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/fixedcolumns/3.0.2/css/dataTables.fixedColumns.css">

You can reference them here or find them in the latest version

3 Comments

Added them to the JS Fiddle's external resources. Doesn't help. See here: jsfiddle.net/Ue6Gn/19
That would be my fault, I misread your question. The FixedColumns plugin creates clones of the datatable object and overlays those on top of the columns that you are locking. Have you tried writing your own customer scrollbar?
Not yet... my hope was that the plugin would do the same thing on my site as it did on the demo on the DataTables site... but apparently, that doesn't look like it's possible. On to other solutions, I guess. Thanks for your suggestions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.