Look, is it possible to sort a table by date in javascript, symfony2 or jquery?
I have a table with several data and records and I would like to sort the records by date.
Look, is it possible to sort a table by date in javascript, symfony2 or jquery?
I have a table with several data and records and I would like to sort the records by date.
Using symfony2 you can already bring the data ordered in the query.
There are several ways to do this, you can query directly on the Controller or create an EntityRepository
For example in the controller:
$em = $repository = $this->getDoctrine()->getRepository('SeuBundle:Post');
//voce pode filtrar por algum campo
$dados = $em->findBy(array('tipo'=>'AB'), array('data'=>'DESC')); //ou ASC
//ou você pode trazer todos os resultados somente ordenando
$dados = $em->findBy(array(), array('data'=>'DESC'));
Source: link