Answer the question
In order to leave comments, you need to log in
Symfony - Twig how to make reusable links for sorting in CRUD?
Hello everyone,
I have many different data sheets in my project. (something like Data-Grid)
Is there any good solution to create links to sort columns?
Thanks a lot, everyone
Answer the question
In order to leave comments, you need to log in
There is a very good and simple solution - use knp paginator. It has a separate item in the settings for setting links for sorting.
template:
pagination: '@KnpPaginator/Pagination/twitter_bootstrap_v4_pagination.html.twig'
sortable: '@KnpPaginator/Pagination/sortable_link.html.twig'
<th>{{ knp_pagination_sortable(pagination, 'Date', 'date') }}</th>
<th>{{ knp_pagination_sortable(pagination, 'Name', 'name') }}</th>
<th>{{ knp_pagination_sortable(pagination, 'Email', 'email') }}</th>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question