Uncaught TypeError: undefined is not a function
Uncaught TypeError: undefined is not a function
I'm trying to initialize the fixedColumns, and get this error back. I have just upgraded to dataTables 1.10 and fixedColumns v.3.01. I've completely stripped everything and left with this:
var table = $('result-table').dataTable({ "scrollX": true, })
new $.fn.dataTable.fixedColumns(table);
In the 'old' (new 2 weeks old haha) version it was a bootstrap issue that could be resolved by doing:
var frozen = new FixedColumns(table) ({});
Is there a fancy way to make fixedColumns and Bootstrap work together in this version?
Answers
Try to replace dataTable() by DataTable() for initialisation.
I'm getting
TypeError: undefined is not a function
with DataTables 1.10.2, and I've tried both:and:
What are your includes for the datatable js files?
Just using the same one from the datatables install guide:
I fixed the problem by including datatables immediately after jQuery. I had some other jQuery libraries I was including between jQuery and DataTables.
Should be:
It is a constructor, so by general convention it gets a capital.
Is there an error in the documentation somewhere that suggests it should be lowercase?
Allan
In the same way you used an upper-case 'D' in 'DataTable' here,
$('#table').DataTable();
you need to do the same here,
new $.fn.dataTable.FixedColumns(table);
should be
new $.fn.DataTable.FixedColumns(table);
Bob
That should not be the case with the latest version of FixedColumns.
$.fn.dataTable.FixedColumns === $.fn.DataTable.FixedColumns
.It probably was true with old v2 releases, but not with the current release.
Allan
Hello allan,
For the following line, I get the error below:
new $.fn.dataTable.FixedColumns(table);
Uncaught TypeError: $.fn.dataTable.FixedColumns is not a function(anonymous function) @ (index):36m.Callbacks.j @ jquery.js:2m.Callbacks.k.fireWith @ jquery.js:2m.extend.ready @ jquery.js:2J @ jquery.js:2
Could you please help me with this? I am using the latest version of DT.
Thanks,
Sounds like you have not included the FixedColumns library. Can you link to the page so we can confirm if that is the issue please.
Allan