Unable to Parse JSON "aData is undefined" for Jersey/Spring webservice.

Unable to Parse JSON "aData is undefined" for Jersey/Spring webservice.

airdusterairduster Posts: 2Questions: 0Answers: 0
edited October 2011 in DataTables 1.8
Hello,

I've seen this issue come up on the forums before and I know it is documented well with examples but I cannot seem to get mine to work. My table #resultSetTable implements datatables... but when I try load data from a RESTFUL web service. it craps out in the javascript layer with the "aData is undefined (line 2435)". If I step through the javascript code with firebug it's obviously not understanding the JSON format thus setting aData to null but I feel I followed the examples in the documentation that correspond to the JSON format provided by my webservice.

Is there something I am overlooking?

Also I would like to be able to dictate when I make queries to the server so I don't want set to bServiceSide: true (..don't want to connect to the server every time the user sorts or searches). Is this possible?

Thanks,


[code]
$(document).ready(function() {
$('#resultSetTable').dataTable( {
"bProcessing": true,
"bServerSide": false, /*also set this to true even though I don't want it, still no go */
/*I even tried to set sAjaxDataProp to "object" with no luck */
/*"sAjaxDataProp": "object",*/
/*"sAjaxDataProp": "Object",*/
"sAjaxSource": "/service/weather",
"aoColumns": [
{ "mDataProp": "localStandardTimezone" },
{ "mDataProp": "localTimezone" },
{ "mDataProp": "stationCode" },
{ "mDataProp": "wban" }
],
} );
} );


[/code]

[code]
/* sample JSON formatting from web service */

[

{"localStandardTimezone":"America/Dawson_Creek","localTimezone":"","stationCode":"","wban":"+7"},
{"localStandardTimezone":"Atlantic/Reykjavik","localTimezone":"","stationCode":"BIKF","wban":"+0"},
{"localStandardTimezone":"America/Vancouver","localTimezone":"","stationCode":"CYAL","wban":""},
{"localStandardTimezone":"America/Winnipeg","localTimezone":"","stationCode":"CYAQ","wban":""},
{"localTimezone":"something","stationCode":"HJH","wban":"828"},
{"localTimezone":"American/Central","stationCode":"HUZ","wban":"+52"},
{"localTimezone":"America/yea","stationCode":"TestStation","wban":"+225"},
{"stationCode":"XYZ","wban":"2323555"}

]

[/code]

[code]
/*Also tried just requesting for 1 object. It still did not work */

[
{"localStandardTimezone":"Atlantic/Reykjavik","localTimezone":"","stationCode":"BIKF","wban":"+0"}
]

[/code]

Screen Shot of firebug in real time:
http://img208.imageshack.us/img208/3293/8393ae988be54e06935a392.png

Replies

  • airdusterairduster Posts: 2Questions: 0Answers: 0
    never mind it randomly hit me this evening when I was using the bathroom!
    I was missing

    [code]
    "sAjaxDataProp": ""
    [/code]

    I would still like to know though the following

    "Also I would like to be able to dictate when I make queries to the server so I don't want set to bServiceSide: true (..don't want to connect to the server every time the user sorts or searches only event controlled table updates). Is this possible?"
This discussion has been closed.