Cannot read property 'mData' of undefined Error when initialising DataTables
Cannot read property 'mData' of undefined Error when initialising DataTables
I am brand new to DataTables but I seem to be falling at the first hurdle.
I have a table in my HTML page that I wish to populate with some values using a function which generates a table for me in HTML DOM. By default the table is empty on the HTML page:
<table id="tblResults">
</table>
I run the function that gets the data that I want. I know the data is there as if I call:
var updatedresults = document.getElementById("tblResults").outerHTML;
console.log(updatedresults);
I have checked the data output and this all looks fine.
However when I then call:
$('#tblResults').DataTable();
I get the following error:
jquery.dataTables.min.js:90 Uncaught TypeError: Cannot read property 'mData' of undefined
Please Help!!
Many Thanks
Dave