Default grouping direction
Is there any way we can set up the default grouping direction so that it is
desc
instead of asc
?
I think right now it is not really possible given the below line, where the asc
is hard-coded:
https://github.com/filamentphp/filament/blob/c634245cd64af3dc06bd0d7ba40d5d2b76b96b38/packages/tables/resources/views/components/groups.blade.php#L2810 Replies
You can set an default sort on the table? Or is that not what you mean?
For sorting all records in the table yes, but in case I group my records (by date for example), I want the groups to be sorted with the latest dates first and for now weirdly enough that doesn't seem to be possible :/
you can use the getTableQuery and write a custom ordering
did you figure this out? i'm trying to group by
order_number
but sort by order_date
. this works when the order_date
is the same, but when changed, it creates separate groupsNope, ended up just dropping it as it wasn't a critical feature for me :/
Hey just putting in a note that I was looking for this feature as well
Yes it would be great to have this feature
I had to do it like this for now
@uzdacpdz (Doug Dimmadome)
You can already define default order.
Below is my "Group" with
orderQueryUsing
Hi, has anyone found how to do this? The solution given above hide the dropdown for all groups so that is not an option for me.
I ended up hard coding the direction in the
->orderQueryUsing(fn (Builder $query, string $direction) => $query->orderBy('date', 'desc'))
but the 'direction' dropdown no longer works.