Hi Benjamin!

That should be possible. If you have already set up filters for that
very module, you will see the generated method addFiltersCriteria() in
your cached actions.class.php. This method adds the criteria of the
filter to the query of the list action before it is executed. You can
override that method to add any custom criteria you want.

Using your example, you would add the partial _approved to the
list:filters field in generator yml. That partial would f.i. contain a
checkbox with the name "TableA[TableB_approved]".

In the overridden addFiltersCriteria(), you can (after calling the
parent method) query that data and add the criteria to your
Criteria(Propel)/Query(Doctrine) object.

Regards

Bernhard


Am Dienstag, den 18.09.2007, 23:11 -0600 schrieb Benjamin Ingmire:
> Charley, Bernhard,
> 
> Your question made me wonder:
> 
> Is it possible to create a filter in the generated admin that filters
> on records in a related table?
> 
> For instance:
> 
> TableA
> id
> user_id
> created_at 
> 
> TableB
> id - relates to TableA.user_id
> approved
> 
> Can a generated TableA be filtered on TableB.approved?
> 
> Thanks,
> 
> Ben
> 
> On 9/17/07, Charley Tiggs <[EMAIL PROTECTED]> wrote:
>         
>         Bernhard,
>         
>         Thanks for the response.  Figured it out based on your
>         response.
>         
>         Simply create a _filters.php in
>         backend/modules/mymodule/templates
>         with only the following:
>         
>         <?php use_helper('Object') ?> 
>         
>         Doing so means that the filter fields on the right hand side
>         of the
>         screen will not show but you can use filter params to show
>         filtered
>         results.
>         
>         Thanks!
>         
>         Charley
>         
>         On Sep 17, 2007, at 4:43 PM, Bernhard Schussek wrote: 
>         
>         >
>         > Hello!
>         >
>         > <?php echo link_to('Filtered!',
>         > 'module/list?filter=filter&filters['.$field.']='.$value) ?>
>         >
>         > Check the cached generated source if you want to find out
>         more 
>         > secrets ;-)
>         >
>         > Regards
>         >
>         >
>         > Am Montag, den 17.09.2007, 16:38 -0500 schrieb Charley
>         Tiggs:
>         >> Howdy folks,
>         >>
>         >> For a module created with the admin generator, is it
>         possible to 
>         >> filter results without having to display the filter
>         fields?  All I
>         >> want to do is show the filtered list of subcategories when
>         my custom
>         >> object action is clicked for a category.
>         >> 
>         >> Thanks,
>         >>
>         >> Charley
>         >>
>         >>>
>         >
>         >
>         > >
>         
>         
>         
>         
> 
> 
> > 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to