This is the data returned by ajax call.
{
"totalRecords": 20,
"draw": 2,
"data": [
{
"DT_RowId": "row_1",
"first_name": "Tiger",
"last_name": "Nixon",
"addInfo": [
{
"city": "Texas",
"familyDetails ": {
"name1 ": "Arxin",
"name2 ": "Drav"
}
}
]
},
{
"DT_RowId": "row_2",
"first_name": "Garrett",
"last_name": "Winters",
"addInfo": [
{
"city": "Texas",
"familyDetails ": {
"name1 ": "Rog",
"name2 ": "Arim"
}
}
]
}
]
}
This is the data table initialization, which uses server side pagination.
$(document).ready(function() {
$('#example').DataTable( {
serverSide: true,
paging:true,
ajax: "../php/staff.php",
columns: [
{ data: "first_name" },
{ data: "last_name" }
]
} );
$('#example tbody').on('click', 'tr', function () {
var data = table.row( this ).data();
alert( 'You clicked on '+data[0]+'\'s row' );
} );
});
Here, I want to get the additional information on data row click other than thae data table row data. How can I get the json "addInfo" associated with each row.
Note: Found an option to add as hidden variable, but keeping json as hidden is tedious.