EasyAdmin: Add page numbers to list view

The original EasyAdmin paginator template does not include the page numbers, but only the “first”, “previous”, “next” and “last” buttons. Since EasyAdmin uses the popular PagerFanta paginator bundle, it is quite easy to add the missing parts for showing the page numbers in the template.

Since there are no blocks defined in the paginator template, you will have to copy the whole template to your local application template folder and add the changes here. Below is the complete template file including the code for adding the page numbers. The custom code is inspired by https://gist.github.com/SimonSimCity/4594748

For a Symfony 4 application, create the template here:
Symfony will automatically apply the new template.

You can change the amount of previous and next pages displayed by setting the value of the nearbyPagesLimit variable.

Edit: I created a pull request to the EasyAdminBundle to get the pagination nicely integrated and configurable. It would be nice to get a thumb up or a comment to get it merged :) https://github.com/EasyCorp/EasyAdminBundle/pull/2338/files




Web Developer in Berlin — www.kcmueller.de

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
KC Müller

KC Müller

Web Developer in Berlin — www.kcmueller.de

More from Medium

Magento vendors, do you test your code for php8 compatibility at all?

Show a CMS Page in frontend through XML-Magento 2

Accelerate the purchasing 🛍 process in e-commerce based on Shopware 6

Magento 2 Useful Commands List