3

I have a project using Symfony 2.5 with SonataAdminBundle (http://sonata-project.org/) with a list of Posts, using pagination and list filtering that comes generic with the bundle.

If I go to n-th page using pagination, then go to 'Edit' page and click 'Update and close', when it's done updating, it returns me to the first page of my list. Same happens with 'Show' action when I want to return using breadcrumbs, it returns to page 1. Same scenario with a filtered list.

Is there a way to save the URL of the list (with pagination/filters enabled) and make sure it returns to the point it came from after editing ?

Thanks in advance,

Ulugbek

Ulugbek
  • 164
  • 1
  • 8

2 Answers2

2

I was able to enable this behavior with this config addition in app/config/config.yml:

sonata_admin:
    persist_filters: true

This was available in a project running sonata-project/admin-bundle version ~3.13.

John Pancoast
  • 1,241
  • 16
  • 14
0

you should try with getPersistentParameters function.

public function getPersistentParameters()
{
    if (!$this->getRequest()) {
        return array();
    }

    return array(
        'provider' => $this->getRequest()->get('provider'),
        'Cliente'  => $this->getRequest()->get('Cliente'),
    );
}

It keeps the value of a parameter after editing the object.

Cobak
  • 31
  • 4