EasyAdminPlus
is packaged with a filter module
The filter
is disabled by default.
To enable it, you've to add a new action node (filter
) in EasyAdmin
configuration like others ones (list
, show
, new
, edit
, form
, delete
, search
).
Here's a list of all filters:
- AbstractORMFilterType
- BooleanFilterType
- ChoiceFilterType
- DateFilterType
- DateTimeFilterType
- EntityFilterType
- EnumerationFilterType
- ExactStringFilterType
- ManyFilterType
- NotNullFilterType
- NumberFilterType
- NumberRangeFilterType
- PeriodeFilterType
- StringFilterType
- TreeFilterType
- UrlAutoCompleteFilterType
- WorkflowFilterType
You've to add this action on all Entities on which you want to enable filter
feature.
# config/packages/easy_admin.yaml
easy_admin:
entities:
Demande:
class: App\Entity\Demande
filter:
fields:
- { label: 'Source', filter_type: 'StringFilterType', property: 'source', default: {comparator:'equal', value:'def' }}
- { label: 'Type', filter_type: 'ChoiceFilterType', property: 'type', config: {choices: ['DI', 'CONTACT', 'INSTALLATION']} }
- { label: 'Date', filter_type: 'DateFilterType', property: 'date' , default: 'now'}
- { label: 'Statut', filter_type: 'StringFilterType', property: 'status' }
- { label: 'Code Client', filter_type: 'StringFilterType', property: 'codeClient' }
- { label: 'Client', filter_type: 'AutoCompleteFilterType', property: client, config: {'entity':'Client'} }
A new panel is visible on top of List
action with all the filters widget.
The filters params are stored in session and can be reset by the Cancel button. When you return on the list the filter is reminded