FixedColumns example ColVis integration

FixedColumns operates with DataTables' built-in column visibility options (columns.visibleDT and column().visible()DT), which columns that are hidden not being shown in the fixed columns. This integration also means that FixedColumns works well with ColVis, with columns that are dynamically shown and hidden updated immediately in the fixed columns.

The example below shows ColVis and FixedColumns working together. Two columns have been fixed on the left hand side of the table to show FixedColumns ability to work effortlessly with column visibility.

The Javascript shown below is used to initialise the table shown in this example:

1
2
3
4
5
6
7
8
9
10
11
12
13
$(document).ready(function() {
    var table = $('#example').DataTable( {
        dom:            "Cfrtip",
        scrollY:        "300px",
        scrollX:        true,
        scrollCollapse: true,
        paging:         false
    } );
 
    new $.fn.dataTable.FixedColumns( table, {
        leftColumns: 2
    } );
} );

In addition to the above code, the following Javascript library files are loaded for use in this example: