F
Filament17mo ago
Iztok

Page with table, query URL

I changed a ViewRecord page to a show a table, which works fine, but when applying filters or sorting, the URL does not update. What would be a way to force URL query to change on this page?
6 Replies
Patrick Boivin
Patrick Boivin17mo ago
How did you add the table to the page? Did you wrap it in a custom livewire component or implement HasTable on the page directly?
Iztok
IztokOP17mo ago
class ViewBucketCustom extends ViewRecord implements Tables\Contracts\HasTable
Patrick Boivin
Patrick Boivin17mo ago
Not 100% sure, but you can try this on the page class:
protected $queryString = [
'isTableReordering' => ['except' => false],
'tableFilters',
'tableSortColumn' => ['except' => ''],
'tableSortDirection' => ['except' => ''],
'tableSearchQuery' => ['except' => ''],
];
protected $queryString = [
'isTableReordering' => ['except' => false],
'tableFilters',
'tableSortColumn' => ['except' => ''],
'tableSortDirection' => ['except' => ''],
'tableSearchQuery' => ['except' => ''],
];
Iztok
IztokOP17mo ago
this does the trick! thanks!
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Patrick Boivin
Patrick Boivin17mo ago
I don't think multi-column default sort is supported unfortunately. But it looks like you could implement it by overriding applyDefaultSortingToTableQuery() on your Page class. https://github.com/filamentphp/filament/blob/adba0e076f7ddfb358e4a167e83eb10bbaf93d27/packages/tables/src/Concerns/CanSortRecords.php#L94
Want results from more Discord servers?
Add your server