Browse Source

Fix nested admin filtering

Thomas Rabaix 14 years ago
parent
commit
0cb5e14670
1 changed files with 8 additions and 6 deletions
  1. 8 6
      Admin/Admin.php

+ 8 - 6
Admin/Admin.php

@@ -575,12 +575,6 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
             return;
         }
 
-        // ok, try to limit to add parent filter
-        if ($this->getParentAssociationMapping()) {
-            $fieldDescription = $this->getModelManager()->getParentFieldDescription($this->getParentAssociationMapping(), $this->getClass());
-            $this->filterFieldDescriptions[$this->getParentAssociationMapping()] = $fieldDescription;
-        }
-
         $parameters = $this->getFilterParameters();
 
         // initialize the datagrid
@@ -592,6 +586,14 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
 
         // build the datagrid filter
         $this->configureDatagridFilters($mapper);
+
+        // ok, try to limit to add parent filter
+        if ($this->getParentAssociationMapping()) {
+            $fieldDescription = $this->getModelManager()->getParentFieldDescription($this->getParentAssociationMapping(), $this->getClass());
+            $this->filterFieldDescriptions[$this->getParentAssociationMapping()] = $fieldDescription;
+
+            $mapper->add($fieldDescription);
+        }
     }
 
     /**