11# Grid Views
22
3- Grid views are a generic solution for the creation of listings, as they occur again and again in the software.
4- In addition to rendering, the grid view also take care of sorting, filtering and pagination and ensure that a lot of boilerplating becomes obsolete.
3+ Grid views are a generic solution for the creation of listings that are ubiquitous in the software.
4+ In addition to rendering, the grid view also take care of sorting, filtering and pagination, and ensure that a lot of boilerplating becomes obsolete.
55
66The implementation essentially offers the following advantages:
771 . A uniform appearance and usability for the user.
@@ -141,7 +141,7 @@ GridViewColumn::for('foo')
141141
142142#### DefaultColumnRenderer
143143
144- The ` DefaultColumnRenderer ` is automatically applied to all columns if no other renderers have been set.
144+ The ` DefaultColumnRenderer ` is implicitly applied to all columns unless one ore more renderers have been explicitly set.
145145
146146#### EmailColumnRenderer
147147
@@ -153,7 +153,7 @@ The `DefaultColumnRenderer` is automatically applied to all columns if no other
153153
154154#### IpAddressColumnRenderer
155155
156- ` IpAddressColumnRenderer ` renders ipv6 embedded ipv4 address into ipv4 or returns input if true ipv6 .
156+ ` IpAddressColumnRenderer ` outputs the value by attempting to interpret it as IPv4 if possible, otherwise shows the IPv6 address .
157157
158158#### LinkColumnRenderer
159159
@@ -176,7 +176,7 @@ GridViewColumn::for('foo')
176176
177177#### PhraseColumnRenderer
178178
179- ` PhraseColumnRenderer ` formats the content of a column as a phrase .
179+ ` PhraseColumnRenderer ` attempts to evaluate the value as a phrase and outputs it as plain text otherwise .
180180
181181#### TimeColumnRenderer
182182
@@ -250,7 +250,7 @@ Optionally, you can specify the name of an alternative database column to be use
250250
251251``` php
252252GridViewColumn::for('foo')
253- ->sortable(sortByDatabaseColumn: "another_table.bar ")
253+ ->sortable(sortByDatabaseColumn: "table_alias.columnName ")
254254```
255255
256256The default sorting can be defined after the column configuration has been defined:
@@ -297,7 +297,7 @@ GridViewColumn::for('categoryID')
297297
298298#### IpAddressFilter
299299
300- ` IpAddressFilter ` is a filter for columns that contain ipv6 addresses, allowing the user to enter addresses in the ipv4 format.
300+ ` IpAddressFilter ` is a filter for columns that contain IPv6 addresses, allowing the user to enter addresses in the IPv4 format too .
301301
302302#### NumericFilter
303303
@@ -341,10 +341,13 @@ Example of adding an additional column:
341341$eventHandler->register(
342342 \wcf\event\gridView\UserRankGridViewInitialized::class,
343343 static function (\wcf\event\gridView\UserRankGridViewInitialized $event) {
344- $event->gridView->addColumnBefore(GridViewColumn::for('hideTitle')
345- ->label('hideTitle')
346- ->renderer(new NumberColumnRenderer())
347- ->sortable(), 'requiredPoints');
344+ $event->gridView->addColumnBefore(
345+ GridViewColumn::for('hideTitle')
346+ ->label('hideTitle')
347+ ->renderer(new NumberColumnRenderer())
348+ ->sortable(),
349+ 'requiredPoints'
350+ );
348351 }
349352);
350353```
0 commit comments