IE errors on a subgrid - bad JSON formatting?
IE errors on a subgrid - bad JSON formatting?
I'm viewing a 'Grid-within-Grid' table - the initial page works fine - when a subgrid is unfolded IE tosses a javascript alert - "added data does not match number of known columns" - all works fine for firefox.
Searching on IE here i find there is a report that FF is more tolerant of malformed JSON than IE but I don't see anything clearly wrong (a firebug screenshot at http://screencast.com/t/ODk0YzI5Y)
I'm pulling data from a .net MVC project and wonder if perhaps the way JSON is serialized is the root cause here.
Searching on IE here i find there is a report that FF is more tolerant of malformed JSON than IE but I don't see anything clearly wrong (a firebug screenshot at http://screencast.com/t/ODk0YzI5Y)
I'm pulling data from a .net MVC project and wonder if perhaps the way JSON is serialized is the root cause here.
This discussion has been closed.
Replies
From your screenshot, the aaData array actually contains objects etc as well as just raw data. What datatables expects is:
[code]
{
aaData: [
[
"1",
"2",
"3"
],
[
"4",
"5",
"6"
]
]
}
[/code]
So I think you need to remove the objects that are being output, and just fire out a basic 2D array.
Note also that the inner arrays must each have the same length as the number of columns in the table, otherwise you will get the alert() that you are seeing.
Regards,
Allan
//order date
{"sWidth": "40%" },
to:
//order date
{"sWidth": "40%" }
fixed the problem for IE.
Yup - that trailing comma is a real nuisance. I can't understand why Firefox allows it... But good that you got it working :-)
Regards,
Allan