Normally I use ajax and in the .done
I do a for for the data that I received to show them in the view of the following way:
for (var i = data.length -1; i >= 0; i--)
{
var rowNode = table
.row.add([
data[i].nombre,
data[i].apellido,
])
.draw()
.node();
}
What happens now is that I do not want to use ajax but clearly the function of datatables but I would not know how to perform a for cycle inside that function to load the data in the data ...
CODE DATATABLES
$(function() {
var table = $('.row-details-data-table').DataTable({
"ajax": "../students",
dom: '<"tbl-top clearfix"lfr>,t,<"tbl-footer clearfix"<"tbl-info pull-left"i><"tbl-pagin pull-right"p>>',
"columns": [{
"class": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
}, {
"data": "name"
}, {
"data": "position"
}, {
"data": "office"
}, {
"data": "salary"
}],
"order": [
[1, 'asc']
]
});
I would appreciate a lot ..