How to change pagination in easyadmin 3

2k Views Asked by At

I am using symfony 5.2 and easyadmin 3 for backend. In the easyadmin 3 there is default pagination style and structure is like Previous | Next. Now, I need to change pagination like First | Previous | 1 | 2 | 3 | 4 | 5 | Next | Last.

Is there any way to change pagination in symfony easyadmin 3.

2

There are 2 best solutions below

1
On

found this here. It is missing the [first] and [last] options but maybe this is a start.

public function configureCrud(Crud $crud): Crud
{
    return $crud
        [...]

        // the number of pages to display on each side of the current page
        // e.g. if num pages = 35, current page = 7 and you set ->setPaginatorRangeSize(4)
        // the paginator displays: [Previous]  1 ... 3  4  5  6  [7]  8  9  10  11 ... 35  [Next]
        // set this number to 0 to display a simple "< Previous | Next >" pager
        ->setPaginatorRangeSize(4)

        [...]
    ;
}
0
On

Using EasyAdmin 4 this seems to be the default now: enter image description here

The page numbers of the first and the last page are always visible, so there's no need for extra buttons (any more).