Show filtering and sorting in url
If you want to show filtering and sorting in url, you need to rewrite default LaraGrid properties. You can do it like this:
abstract class MyBaseGrid extends BaseLaraGrid
{
#[Url] // we added this line
public array $filter = [];
#[Url(except: 'id')] // we added this line
public string $sortColumn = 'id';
#[Url] // we added this line
public string $sortDirection = 'desc';
protected function getFilterResetButton(): FilterResetButton
{
return FilterResetButton::make();
}
protected function getTheme(): BaseLaraGridTheme
{
return MyTheme::make();
}
}
Those Url params are default from livewire, so you can customize them as you want by following livewire docs.
Last updated
Was this helpful?