Multiple tables and FixedColumns (or any plugin, from what the forums show) does not work

Multiple tables and FixedColumns (or any plugin, from what the forums show) does not work

paj006paj006 Posts: 1Questions: 0Answers: 0
edited July 2012 in General
I am trying to get FixedColumns to work with multiple tables. Here is a complete working example, as simple as I can possibly make it. As you can see, the top table correctly locks the column, but the second table does not. The tables are created dynamically.

Any ideas? :(

[quote][code]


















$(document).ready(function() {

var oTable = $('.multidatatable').dataTable( {
"sScrollX": "100%",
"sScrollXInner": "150%",

} );
new FixedColumns( oTable, {
"iLeftColumns": 1
} );
} );


[/code][/quote]

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    FixedColumns is currently limited in its initialisation to a single table per instance. As such, you need to create a new FixedColumns instance for each DataTable. For example:

    [code]
    $('.multidatatable').each( function () {
    new FixedColumns( $(this).dataTable() );
    } );
    [/code]

    Something I'll add to the list to see if it can be improved.

    Thanks for the feedback,
    Allan
  • joshuajoshua Posts: 1Questions: 0Answers: 0
    edited January 2013
    I'm currently struggling with the same problem. Where should I put your fix, Alan?
    Code:
    [code]jQuery(document).ready(function() {
    var oTable = jQuery('.datatable').dataTable({
    "bFilter": false,
    "bInfo": false,
    "bPaginate": false,
    "sScrollX": "100%",
    "sScrollXInner": "110%",
    "bScrollCollapse": true
    });
    new FixedColumns(oTable,{
    "iLeftColumns": 1,
    "iRightColumns": 1,
    "sLeftWidth": "relative",
    "iLeftWidth": 30,
    "sRightWidth": "relative",
    "iRightWidth": 20
    });
    });[/code]
This discussion has been closed.