length is null or not an object - on valid json
length is null or not an object - on valid json
Hello
first off, dataTables is a fantastic bit of work. I keep getting deeper and deeper into it, and it is well done.
I am getting this error under IE8, referring specifically to line 2046 of dataTables.js. I am returning data from the server side. The overall dataTable does render, but shows no data. The weird thing is that the data renders correctly under Firefox, Opera, and Chrome but not IE. I have validated the returned json at jsonlint.com. Line 2046 refers to the first line here:
[code]
if ( aData.length != oSettings.aoColumns.length )
{
alert( "Warning - added data does not match known number of columns" );
return -1;
}
[/code]
I even tried commenting this out, but I continued to get errors further on in the script. I am not returning anything amazingly complex. Here is an example:
[code]
{
"sDebug": "",
"sEcho": 1,
"iTotalRecords": 1,
"iTotalDisplayRecords": 1,
"aaData": [
[
"MT",
"Fake Company Inc",
"bryan",
"jones",
"Staff Electrical Engineer Magnetic Resonance",
"Chicago",
"IL",
"45",
"000-00-0000"
]
]
}
[/code]
any ideas?
Doug
first off, dataTables is a fantastic bit of work. I keep getting deeper and deeper into it, and it is well done.
I am getting this error under IE8, referring specifically to line 2046 of dataTables.js. I am returning data from the server side. The overall dataTable does render, but shows no data. The weird thing is that the data renders correctly under Firefox, Opera, and Chrome but not IE. I have validated the returned json at jsonlint.com. Line 2046 refers to the first line here:
[code]
if ( aData.length != oSettings.aoColumns.length )
{
alert( "Warning - added data does not match known number of columns" );
return -1;
}
[/code]
I even tried commenting this out, but I continued to get errors further on in the script. I am not returning anything amazingly complex. Here is an example:
[code]
{
"sDebug": "",
"sEcho": 1,
"iTotalRecords": 1,
"iTotalDisplayRecords": 1,
"aaData": [
[
"MT",
"Fake Company Inc",
"bryan",
"jones",
"Staff Electrical Engineer Magnetic Resonance",
"Chicago",
"IL",
"45",
"000-00-0000"
]
]
}
[/code]
any ideas?
Doug
This discussion has been closed.
Replies
Originally, the data had an extra hanging comma after the last record which must have been causing the error. But when I fixed it, somehow IE continued to give an error...perhaps it cached the response? I restarted IE and the error went away.
Cheers,
Doug