Selaa lähdekoodia

Merge pull request #1022 from lopsided/master

Persistent filters - fix reset button
Thomas 12 vuotta sitten
vanhempi
commit
e1506a408f
2 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 1 1
      Admin/Admin.php
  2. 1 1
      Resources/views/CRUD/base_list.html.twig

+ 1 - 1
Admin/Admin.php

@@ -694,7 +694,7 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
 
             // if persisting filters, save filters to session, or pull them out of session if no new filters set
             if ($this->persistFilters) {
-                if ($filters == array()) {
+                if ($filters == array() && $this->request->query->get('filters') != 'reset') {
                     $filters = $this->request->getSession()->get($this->getCode().'.filter.parameters', array());
                 } else {
                     $this->request->getSession()->set($this->getCode().'.filter.parameters', $filters);

+ 1 - 1
Resources/views/CRUD/base_list.html.twig

@@ -191,7 +191,7 @@ file that was distributed with this source code.
 
                     <input type="submit" class="btn btn-primary" value="{{ 'btn_filter'|trans({}, 'SonataAdminBundle') }}" />
 
-                    <a class="btn" href="{{ admin.generateUrl('list') }}">{{ 'link_reset_filter'|trans({}, 'SonataAdminBundle') }}</a>
+                    <a class="btn" href="{{ admin.generateUrl('list', {filters: 'reset'}) }}">{{ 'link_reset_filter'|trans({}, 'SonataAdminBundle') }}</a>
 
                 </div>
             </fieldset>