Girdfield pagination on v4.x

Silverstripe Version 4.4.4


I’m having trouble setting the number of items per page on a Gridfield list in v4

Previously (v3) I would have done it like this:


I’ve added these two namespaces

    use SilverStripe\Forms\GridField\GridFieldConfig;
    use SilverStripe\Forms\GridField\GridFieldPaginator;

but I get “Uncaught Error: Call to a member function setItemsPerPage() on null

Can anyone point me in the right direction to get this working?

Instead of “GridFieldPaginator” try GridFieldPaginator::class?

Alternatively, if you want to set this globally, try adding the following YML:

  default_items_per_page: 20