Am getting 'TypeError: data is null' in console
Am getting 'TypeError: data is null' in console
EndUser
Posts: 5Questions: 2Answers: 0
I'm trying to initialize a table from an ajax source. I've set my server response to resemble:
{"data": [{"fname":"Stephen"}, (...)]}
and I'm testing it out with this initialization command:
$('#data-table')
.DataTable({
serverSide:true,
ajax:{url:'/position/14'},
columns:[{data:'fname'}]
})
However, in the javascript console, I get an error TypeError: data is null
on jquery.dataTables.js:2689:5 I tried a break point there, and it executes 4 times; the third time through has the column name, but the fourth is null & undefined. What am I missing?
This discussion has been closed.
Answers
You could change
to be
but what you have should work.
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
Ok, it's not great because it's not precisely my use-case, but here's an example ~~that should demonstrate my issue~~. Maybe.
No, this works. I don't know how to provide a test case when I can't provide an ajax source.
Ok, I think I found it. My datasource returned the occasional null row: