Terraformers\RichFilterHeader\Form\GridField\RichFilterHeader
Class RichFilterHeader
filter header with customisable filter fields and filters
fields that use XHR are supported
REQUIREMENTS:
table header component needs to be present in the GridField (for example GridFieldSortableHeader)
the last column of the table needs to have a vacant header cell so the filter widget could be displayed there
for example you can't have the last column with sorting header widget and filter widget at the same time
If GridFieldPaginator is present, this filter component needs to be added BEFORE pagination component
FILTER CONFIG
Filter configuration that dictates what will filters will be displayed,
how GridField column names will be mapped to field names and what data filtering functionality will be used
if left unspecified it falls back to DataObject searchable_fields and then to summary_fields
note that searchable_fields and summary_fields have slightly different syntax in some cases
so manual setup on the GridField may be necessary
Synopsis
- // constants
- const FILTER_ALL_KEYWORDS = 'filter_all_keywords';
- const FILTER_MANY_MANY_RELATION = 'filter_many_many_relation';
- // members
- private static string $field_name_encode = 'filter[%s][%s]';
- private static string $field_name_decode = '/^filter\[([^]]+)\]\[([^]]+)\]$/';
- protected string $dataClass = '';
- protected array $filter_config = ;
- protected array $filter_fields = ;
- protected array $filter_methods = ;
- // methods
- protected void setDataClass()
- protected array getFilterConfig()
- protected array parseFieldConfig()
- protected array findFieldConfig()
- protected bool hasFilterMethod()
- protected FormField createField()
- protected Filterable applyAllKeywordsFilter()
- protected DataList applyManyManyRelationFilter()
- public static string createCompositeFieldName()
- public static array parseCompositeFieldName()
- public $this setFilterConfig()
- public $this setFilterFields()
- public $this setFilterMethods()
- public FormField|null getFilterField()
- public boolean canFilterAnyColumns()
- public SS_List getManipulatedData()
- public void handleAction()
- protected bool hasFilterField()
- public array|null getHTMLFragments()
Hierarchy
Extends
- SilverStripe\Forms\GridField\GridFieldFilterHeader
Uses
- SilverStripe\Core\Config\Configurable
Constants
Name | Value |
---|---|
FILTER_ALL_KEYWORDS | 'filter_all_keywords' |
FILTER_MANY_MANY_RELATION | 'filter_many_many_relation' |
Members
private
- $field_name_decode — string
- $field_name_encode — string
protected
- $dataClass — string
- $filter_config
—
array
Filter configuration uses syntax compatible with searchable_fields and summary_fields - $filter_fields
—
array
Custom fields list - all custom fields are stored here - $filter_methods
—
array
Filter methods - filter callbacks can be specified per field or predefined filter methods can be chosen
Methods
protected
- applyAllKeywordsFilter() — Search for items that contain all keywords
- applyManyManyRelationFilter() — Search for items via a many many relation
- createField()
- findFieldConfig()
- getFilterConfig()
- hasFilterField()
- hasFilterMethod()
- parseFieldConfig()
- setDataClass()
public
- canFilterAnyColumns() — Returns whether this {@link GridField} has any columns to sort on at all.
- createCompositeFieldName()
- getFilterField()
- getHTMLFragments()
- getManipulatedData()
- handleAction()
- parseCompositeFieldName()
- setFilterConfig() — 'searchable_fields' and 'summary_fields' configuration formats are supported
- setFilterFields() — configuration format:
- setFilterMethods() — configuration format: