Commit b23b8266 authored by Ludwig Ruderstaller's avatar Ludwig Ruderstaller

Using new FancyGrid Bundle

parent 47db48a2
......@@ -143,5 +143,29 @@ class {{ type }}Controller extends AbstractCrudController
{
return $this->deleteHandler($crudObject, $request);
}
/**
* @param Request $request
*
* @Route("/list/data")
* @Method({"GET"})
* @Security("has_role('ROLE_ADMIN')")
*
* @return JsonResponse
*/
public function ajaxDataAction(Request $request)
{
$options = [
'filter' => urldecode($request->get('filter', '')),
'page' => $request->get('page', 1),
'sortField' => $request->get('sort'),
'sortDir' => $request->get('dir'),
];
$grid = $this->getGrid($options);
$data = $grid->getData();
return new JsonResponse($data);
}
{% endblock class_body %}
}
......@@ -9,12 +9,12 @@
*/
namespace {{ namespace }}\Infrastructure\Web\Grid;
use Cwd\BootgridBundle\Column\ActionType;
use Cwd\BootgridBundle\Column\DateType;
use Cwd\BootgridBundle\Column\NumberType;
use Cwd\BootgridBundle\Column\TextType;
use Cwd\BootgridBundle\Grid\AbstractGrid;
use Cwd\BootgridBundle\Grid\GridBuilderInterface;
use Cwd\FancyGridBundle\Column\ActionType;
use Cwd\FancyGridBundle\Column\DateType;
use Cwd\FancyGridBundle\Column\NumberType;
use Cwd\FancyGridBundle\Column\TextType;
use Cwd\FancyGridBundle\Grid\AbstractGrid;
use Cwd\FancyGridBundle\Grid\GridBuilderInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\OptionsResolver\OptionsResolver;
......@@ -38,7 +38,6 @@ class {{ type }}Grid extends AbstractGrid
'u.createdAt',
[
'label' => 'Created',
'format' => 'd.m.Y H:i:s',
]
))
->add(new DateType(
......@@ -46,8 +45,7 @@ class {{ type }}Grid extends AbstractGrid
'u.updatedAt',
[
'label' => 'Updated',
'visible' => false,
'format' => 'd.m.Y H:i:s',
'hidden' => true,
]
))
->add(new ActionType(
......
......@@ -13,7 +13,7 @@
"minimum-stability": "stable",
"require": {
"php" : ">=7.1.0",
"symfony/framework-bundle": "~3.0",
"symfony/framework-bundle": "~3.0|^4.0",
"cwd/common-bundle": ">=0.1.8"
},
"autoload": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment