I have a table that is getting data from nodejs in Pug. I'm trying to make it a DataTable, so I've followed the steps needed in order to do that. However, I am getting an error 'Cannot read property 'mData' of undefined'. I have included both css and js file needed for DataTables. I found few posts related to the same error, but most of them seems to be due to missing thead/tbody which is not the case in below code.
script(type='text/javascript', src='/DataTables/datatables.js')
link(rel='stylesheet', href='/DataTables/datatables.css', type='text/css')
script.
$(document).ready(function() {
$('#dtable').DataTable();
});
table(id='dtable')
thead
tr
th= tbl_header1
th= tbl_header2
th= tbl_header3
th= tbl_header4
th= tbl_header5
th= tbl_header6
th= tbl_header7
th= tbl_header8
th= tbl_header9
th= tbl_header10
th= tbl_header11
th= tbl_header12
th= tbl_header13
tbody
each item in items
if (typeof(item.schema_name) !== 'undefined')
tr
td= item.entity_id
td= item.database_name
td= item.schema_name
td= item.entity_name
td= item.entity_type
td= item.db_user
td= item.entity_owner
td= item.external_table_location
td= item.entity_description
td= item.status
td= item.latest_refresh_column
td
button(class="use-address" id="button" type="button") Edit