Browse Source

add default sort in crud

develop
Simon Vieille 1 month ago
parent
commit
138115ed1a
  1. 5
      src/Controller/Blog/CategoryAdminController.php

5
src/Controller/Blog/CategoryAdminController.php

@ -45,8 +45,11 @@ class CategoryAdminController extends CrudController
->setView('form', 'blog/category_admin/_form.html.twig')
->setDefaultSort('index', 'title', 'asc')
->setField('index', 'Titre', TextField::class, [
'property' => 'title',
'sort' => ['title', '.title'],
])
->setField('index', 'Articles', ButtonField::class, [
'property_builder' => function (EntityInterface $entity) {
@ -65,8 +68,6 @@ class CategoryAdminController extends CrudController
*/
public function index(int $page = 1, RepositoryQuery $query, Request $request, Session $session): Response
{
$query->orderBy('.title', 'ASC');
return $this->doIndex($page, $query, $request, $session);
}

Loading…
Cancel
Save