Get Row Data From Ajax Source
Get Row Data From Ajax Source
In the past I've always used this to get a hidden column's data. I would hide the column with a css class, but the responsive plugin doesn't work well with these.
var td = $('td', this);
var ID = $(td[0]).text();
So I found an alternative, by hiding the columns with this
"columnDefs": [
//Responsive classes
{ className: 'never', targets: 0 }, //Hide on all devices
{ className: 'all', targets: 1 }, //Show on all devices
]
and using either one of these.
var rowData = oTable1.fnGetData(this);
var rowData = oTable1.api().row(this).data();
var ID = rowData[0];
That works well if you don't have an AJAX source. It will return a comma separated list of the row data.
However, when I try to use this with an AJAX source I just get [object Object] back if I output the rowData variable in an alert.
How do I get the row data out of a table with an AJAX source?