Datatable + Google Map Clusters.. How to access DT data in drawCallback?
Datatable + Google Map Clusters.. How to access DT data in drawCallback?

I'm trying to show my table data that contains (longitude and latitude coordinates) on a google map.
I have tested with static JSON data and was successful.
I have figured out that I can use drawCallback to only show data in the table on the google map
However when I try access 'res.data.forEach(function (o, i)' I get a Uncaught TypeError: Cannot read property 'data' of undefined error
res.data.forEach(function (o, i) {
o.hoverData = o.lat + " : " + o.lng;
o.dataset = [{ bar: 'boop' }, { foo: 'baz' }]
o.clickData = "You've clicked on this locaton:<br />" + o.lat + " : " + o.lng;
o.labelStyle = { background: 'salmon' }
});
here is the full code:
https://jsbin.com/rafehul/edit?html,js,output
Thank you for your help!
This question has an accepted answers - jump to answer
Answers
Doesn't look like you have the callback parameters for the d3.json() method correct.
Looking at the docs it has this:
Looks like the callback has only one parameter. This is a d3 issue not a Datatables issue.
Kevin
thanks for answer, i'll keep looking for a solution
Do something like this too see what data is passed into the callback:
Kevin
Kindly see the screenshot of the callback of
d3.json( data, function( d3Data ) {
console.log( d3Data );
});
in the test I did earlier this was the json format:
{
"number_returned": 7539,
"data": {
"result_list": [
}
You have
drawCallback: function (data,settings) {
. The only parameter provided todrawCallback
issettings
. So you will need something like this:This uses
rows().data()
to get the full table data. Theselector-modifier
parameter can be used to control the data retrieved.Kevin
this worked without a problem

Sorry I was trying to help you with the d3.json() function. Thought you had the wrong number of parameters.
You can use
ajax.json()
to get the JSON response from theajax
option.Kevin
no worries Kevin, I just needed to get the JSON response from the ajax option THANKS!