Skip to content

Commit 0fcab1d

Browse files
committed
Document per-column default sort order to grid view columns
ref WoltLab/WCF@226386c
1 parent 4230f43 commit 0fcab1d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎docs/php/api/grid_views.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,14 @@ GridViewColumn::for('foo')
262262
->sortable(sortByDatabaseColumn: "table_alias.columnName")
263263
```
264264

265+
Each column can declare its own default sort order via the `defaultSortOrder` argument (`ASC` or `DESC`).
266+
When the user switches sorting to a different column, the column's default sort order is applied instead of always defaulting to `ASC`:
267+
268+
```php
269+
GridViewColumn::for('time')
270+
->sortable(defaultSortOrder: 'DESC')
271+
```
272+
265273
The default sorting can be defined after the column configuration has been defined:
266274

267275
```php

0 commit comments

Comments
 (0)