Multiple default sort in tables

Is there a way to have multiple columns in the default sort for tables. A simple example would be to sort todos by priority and due date together, first priority, followed by the due date. Thank you very much for the amazing work that is put into this piece of software! Best regards Mike
Solution:
->defaultSort(function ($query, $direction) {
$query->orderBy(...);
})
->defaultSort(function ($query, $direction) {
$query->orderBy(...);
})
...
Jump to solution
3 Replies
Patrick Boivin
In v2 I think the solution was to override applyDefaultSortingToTableQuery() on the page component. Not sure but in v3 it looks like you can pass a closure to the defaultSort() method, on the table.
Solution
Patrick Boivin
->defaultSort(function ($query, $direction) {
$query->orderBy(...);
})
->defaultSort(function ($query, $direction) {
$query->orderBy(...);
})
Mike Wink
Mike WinkOP2y ago
Thank you Patrick. Will give it a try tomorrow!

Did you find this page helpful?