Allow setting a default grouping direction via 'defaultGroup()' #19753
levizandbergenTO
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Feature description
When using
->defaultGroup()on a table, the grouping direction is always initialized toasc. There is no API to configure the default direction.Use case
A table with records naturally sorted descending (newest first) may look like this:
The defaultSort has no effect on group ordering. The group direction is hardcoded to asc in InteractsWithTable::bootedInteractsWithTable():
Proposed solution
Add a defaultGroupingDirection() method on Table, or accept a direction parameter in defaultGroup():
The value would then be read in bootedInteractsWithTable() instead of the hardcoded 'asc'.
Workaround
Currently this requires overriding bootedInteractsWithTable() in the resource's ListRecords page:
This works but relies on framework internals.
Filament version
5.x
Beta Was this translation helpful? Give feedback.
All reactions