JSONP Data Not Being Utilized Properly
JSONP Data Not Being Utilized Properly
Hello! :)
I am trying to create a DataTable based on a $.getJSON request already running on a page hosted in a separate place from my data, because I can't afford to have multiple requests to my data-hosting server. My JSON doesn't look like the examples in the documentation though, and I'm having trouble getting DataTables to understand it, because again, it can't be modified since I can only make one call and the data structure already works for what I am doing on another part of the page (highcharts).
Here is my fiddle: http://jsfiddle.net/NE43x/
And here is my JSONP: http://terran12.t15.org/data.json
Any help in this matter would be greatly appreciated. I tried the ajax.dataSrc and columns.data options and have no luck with those either.
Answers
I think you want to just pass the array in using the
data
option.Allan
Would it be possible for you to post a fiddle of this? I'm not seeing how it would work...
To be clear, when I did the data option as you suggested, I got a table with the right amount of records (~17,000), but the data was all malformed.
I think there needs to be some code to pull the data properly, so that it will say for example:
Column 1 / Column 2
World Federation of Democratic Youth / 12
Poqilet / 11
and so on...
you see what I mean in the JSONP I linked?
So the names first, in one column ("World Federation of Democratic Youth", "Poqilet", "United Society", "Japvia"...), with the numbers in the second part of the JSON: 12, 11, 5, 500...
How do I tell DataTables to pull it out that way?
There is an example of using an array here: http://datatables.net/examples/data_sources/js_array.html . It looks like you already have the array of data, so pass it in using
data
like in the example.Allan