[Datatables 1.10.18]
Given the following snippet does not work. I get an error that says : Cannot set property '_DT_CellIndex' of undefined TypeError: Cannot set property '_DT_CellIndex' of undefined
let resultTable = $('table#results').DataTable( {
"dom": 'Bfrtip',
"columns": [
{ "name": "colPlant" },
{ "name": "colPartNum" },
{ "name": "colStatus" },
{ "name": "colCustomers" },
{ "name": "colComments" },
{ "name": "colAction" }
],
"columnDefs": [{ "bSortable": false,
"targets": [ "colCustomers", "colComments"]}
]
});
I'm trying to set the names of the columns so I can use those names in the targets to make updating in the future easier.
Meanwhile, this works:
let resultTable = $('table#results').DataTable( {
"dom": 'Bfrtip',
"columnDefs": [{ "bSortable": false, "targets": [ 3, 4]} ]
});
Can anyone advise what I'm doing wrong? Is the syntax wrong? Can you use columns and columnDefs in the datatable instantiation like that or are you supposed to use them separately?