FixedColumns 3.0.2: undefined is not a function for line 278: this._fnConstruct( init )

FixedColumns 3.0.2: undefined is not a function for line 278: this._fnConstruct( init )

adammalinowskiadammalinowski Posts: 3Questions: 1Answers: 0
edited September 2014 in Free community support

Can't figure out how to replicate this in DataTables live, but hoping it is simple enough.

Using jQuery 1.11.1 and DataTables 1.10.2, code is simply:

$(document).ready(function() {
    table = $('#table').dataTable({});
    $.fn.dataTable.FixedColumns(table);
});

Result: undefined is not a function for line 278: this._fnConstruct( init )

Works fine without FixedColumns.

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Are you referencing dataTables.fixedColumns.js in your page? It's a separate download.

  • adammalinowskiadammalinowski Posts: 3Questions: 1Answers: 0
    edited September 2014

    I am referencing the extension that comes with DataTables 1.10.2 i.e.

    <script type="text/javascript" src="/static/DataTables-1.10.2/extensions/FixedColumns/js/dataTables.fixedColumns.js"></script>
    

    I can confirm that FixedColumns is loading correctly, and that the error is within the dataTables.fixedColumns.js file.

  • allanallan Posts: 63,520Questions: 1Answers: 10,473 Site admin
    Answer ✓

    $.fn.dataTable.FixedColumns(table);

    Needs the new key word since you are creating a new instance!

    new $.fn.dataTable.FixedColumns(table);
    

    Allan

  • adammalinowskiadammalinowski Posts: 3Questions: 1Answers: 0

    Doh! Thanks!

This discussion has been closed.