uncaught type error trying to get datatable reference
uncaught type error trying to get datatable reference
version 1.10.25
browser: Firefox
OS: Linux
I'm using the package csv-to-html-table (https://github.com/derekeder/csv-to-html-table) to create a table, and it appears to work correctly. But when I try to get a reference to the table created, I get the error: "Uncaught TypeError: aoColumns[srcCol] is undefined"
I create the table with the command:
CsvToHtmlTable.init({
csv_path: '/source,
element: 'table-container',
allow_download: true,
datatables_options: {
"retrieve": true
}
});
The table displays correctly.
Then I try to get a reference to the table created, which has id "#table-container-table":
var table = $('#table-container-table').dataTable( {
"retrieve": true
} );
and I get the above error. The same thing happens if I just try:
var table = $('#table-container-table').DataTable();
Error stack:
Uncaught TypeError: aoColumns[srcCol] is undefined
_fnSortFlatten http://localhost:8000/public/js/datatables.js:5941
_fnSortingClasses http://localhost:8000/public/js/datatables.js:6279
loadedInit http://localhost:8000/public/js/datatables.js:1225
DataTable http://localhost:8000/public/js/datatables.js:1323
jQuery 2
DataTable http://localhost:8000/public/js/datatables.js:881
DataTable http://localhost:8000/public/js/datatables.js:15220
Answers
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin