Set every td ID with corresponding columns data name (server side processing)
Set every td ID with corresponding columns data name (server side processing)
dabee
Posts: 19Questions: 3Answers: 0
Hello
I have this kind of init (simplified):
oTable = $('#form_list').DataTable( {
'serverSide': true,
'processing': true,
'ajax':{
'url': 'api/ssp_forms',
'type': 'POST'
},
'columns': [
{ data: 'booking_id' },
{ data: 'booking_date' },
],
'columnDefs': [
{'targets': ['_all'], 'createdCell': function (td, cellData, rowData, row, col) {
//perhaps some code here to set IDs
}
}
]
});
I get this response from my api:
{
"draw":1,
"recordsTotal":70,
"recordsFiltered":2,
"data":[
{
"booking_id":"25",
"booking_date":"01.10.2016",
},
{
"booking_id":"13",
"booking_date":"30.09.2016",
}
]
}
How do I set first td's ID as "booking_id", and second td's ID as "booking_date" automatically?
Thanks in advance
This discussion has been closed.