cannot read property 'length'
cannot read property 'length'

I have looked at other posts on the forum but I don't see the resolution to my issue.
var ToGenerateTable = $('#ToGenerate').DataTable({
dom: 'frtip',
ajax: 'api/ToGenerate',
dataSrc: 'Table',
idSrc: 'ImportID',
columns: [
{ data: "ImportID" },
{ data: "DeptName" },
{ data: "FTE" },
{ data: "EmployeeCount" }
]
})
json:
{"Table":[{"ImportID":121,"DeptName":"Ag Commissioner","FTE":48.15,"EmployeeCount":50},...
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Its possible the problem is that
ajax.dataSrc
needs to be within an object for theajax
option. Something like this:Also the
idSrc: 'ImportID',
is not correct.idSrc
is an Editor option. You will want to userowId
in Datatables.Kevin
both those were exactly the issues: