My datatable works fine, except for paging, it is disabled.
$('#datatable').dataTable({
'paging': true,
'ordering': true,
'info': true,
'order': [[2, 'desc']],
"columnDefs": [
{"orderable": false, "targets": 6}
],
"processing": true,
"serverSide": true,
"ajax": 'list-load.php',
"deferRender": true
});
public function loadListAction(Request $request)
{
$strSearch = $request->query->get('search');
$start = (int)$request->query->get('0');
$length = (int)$request->query->get('length');
$rep = $this->getDoctrine()->getRepository(Reserva::class);
// Filtered results
$bookings = $rep->findForDatatable($strSearch, $start, $length)->getQuery()->getResult();
// All records
$total = $rep->countAll();
$data = [];
foreach ($bookings as $b) {
$data[] = [
$b->getAd(),
$b->getCl(),
$b->getStart(),
$b->getEnd(),
$b->getEstado(),
$b->getGain(),
'html',
];
}
// Array for response
$res = [
'recordsTotal' => $total,
'recordsFiltered' => count($bookings),
'data' => $data,
];
return new JsonResponse($res);
}