Skip to content

Commit 506a479

Browse files
committed
Update documentation about grid view filtering
1 parent 066dc46 commit 506a479

File tree

1 file changed

+17
-54
lines changed

1 file changed

+17
-54
lines changed

docs/php/api/grid_views.md

Lines changed: 17 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -281,69 +281,32 @@ final class FooGridView extends AbstractGridView
281281
### Filtering
282282

283283
Filters can be defined for columns so that the user has the option to filter by the content of a column.
284+
The method accepts a class string of a filter or an instantiated filter.
284285

285286
```php
286-
GridViewColumn::for('foo')
287-
->filter(new FooFilter())
288-
```
289-
290-
#### BooleanFilter
291-
292-
`BooleanFilter` is a filter for columns that contain boolean values (`1` or `0`).
293-
294-
#### CategoryFilter
295-
296-
`CategoryFilter` is a filter for columns that contain category ids.
287+
GridViewColumn::for('id')
288+
->filter(TextFilter::class);
297289

298-
```php
299-
GridViewColumn::for('categoryID')
300-
->filter(new CategoryFilter((new CategoryNodeTree('identifier'))->getIterator()))
290+
GridViewColumn::for('id')
291+
->filter(new TextFilter('id', 'label'));
301292
```
302293

303-
#### DateFilter
304-
305-
`DateFilter` is a filter for columns that contain unix timestamps.
306-
307-
#### I18nTextFilter
308-
309-
`I18nTextFilter` is a filter for text columns that are using i18n phrases.
310-
311-
#### IpAddressFilter
312-
313-
`IpAddressFilter` is a filter for columns that contain IPv6 addresses, allowing the user to enter addresses in the IPv4 format too.
314-
315-
#### NumericFilter
316-
317-
`NumericFilter` is a filter for columns that contain numeric values.
318-
319-
#### ObjectIdFilter
320-
321-
`ObjectIdFilter` is a filter for columns that contain object ids.
322-
323-
#### SelectFilter
324-
325-
`SelectFilter` allows a column to be filtered on the basis of a select dropdown.
294+
In addition, filters can be assigned directly to the grid view if, for example, filtering should be possible for data that is not displayed as a separate column.
326295

327296
```php
328-
GridViewColumn::for('foo')
329-
->filter(new SelectFilter([
330-
1 => 'value 1',
331-
0 => 'value 0',
332-
]));
297+
class ExampleGridView extends AbstractGridView
298+
{
299+
public function __construct()
300+
{
301+
$this->addAvailableFilters([
302+
new TextFilter('title', 'wcf.global.title'),
303+
]);
304+
}
305+
}
333306
```
334307

335-
#### TextFilter
336-
337-
`TextFilter` is a filter for text columns.
338-
339-
#### TimeFilter
340-
341-
`TimeFilter` is a filter for columns that contain unix timestamps.
342-
In contrast to `DateFilter`, this filter also allows filtering by a specific time.
343-
344-
#### UserFilter
345-
346-
`UserFilter` is a filter for columns that contain user ids.
308+
Grid Views and List Views share the same filters.
309+
A complete list of available filters can be found in the [List View documentation](list_views.md#filtering).
347310

348311
## Events
349312

0 commit comments

Comments
 (0)