Added a route to show all parts.

This commit is contained in:
Jan Böhmer 2019-03-06 00:02:33 +01:00
parent ba33399b20
commit ce77f287e7
2 changed files with 23 additions and 0 deletions

View file

@ -1,5 +1,8 @@
# Latest documentation available at https://omines.github.io/datatables-bundle/#configuration
datatables:
language_from_cdn: false
# Set options, as documented at https://datatables.net/reference/option/
options:
lengthMenu : [10, 25, 50, 100, 250, 500, 1000, 2500]

View file

@ -75,5 +75,25 @@ class PartListsController extends AbstractController
return $this->render('parts_list.html.twig', ['datatable' => $table]);
}
/**
* @Route("/parts")
*
* @param Request $request
* @param DataTableFactory $dataTable
* @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\Response
*/
public function showAll(Request $request, DataTableFactory $dataTable)
{
$table = $dataTable->createFromType(PartsDataTable::class)
->handleRequest($request);
if ($table->isCallback()) {
return $table->getResponse();
}
return $this->render('parts_list.html.twig', ['datatable' => $table]);
}
}