diff --git a/config/packages/datatables.yaml b/config/packages/datatables.yaml index a97edf2f..21f02498 100644 --- a/config/packages/datatables.yaml +++ b/config/packages/datatables.yaml @@ -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] diff --git a/src/Controller/PartListsController.php b/src/Controller/PartListsController.php index d1ce16c1..b05867b2 100644 --- a/src/Controller/PartListsController.php +++ b/src/Controller/PartListsController.php @@ -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]); + } + } \ No newline at end of file