I have the following query:
$denuncias = DB::table('denuncias')
->join('imputados','denuncias.imputado_id','=','imputados.idImputado')
->select('denuncias.idDenuncia as idDenuncia',
DB::raw('CONCAT(imputados.nombre," ", imputados.apPaterno," ",imputados.apMaterno) as imputado'),
'denuncias.fechaRegistro',
->orderBy('denuncias.fechaRegistro','DESC')
->get();
And I order this query by record date which field is of the datetime type, now I pass it to the Yajra datables:
return Datatables::of($denuncias)->make(true);
and this record is displayed in my blade view, the only problem is that it does not order by date, as if it omits the orderby, now when I do the query with postman it returns the ordered query, so the problem is in the yajra. The only solution I found was that from the js I order it using this command:
"order": [[ 3, "desc" ]]
Does anyone know why it doesn't order it from the server?
Try disabling the order of the datatables.
Try it this way:
And we add: