title | weight |
---|---|
Available Methods |
4 |
These are the available filters configuration methods on the component.
Filters are enabled by default but will only show up if you have at least one defined.
Enable/disable filters for the whole component.
public function configure(): void
{
$this->setFiltersStatus(true);
$this->setFiltersStatus(false);
}
Enable filters for the component.
public function configure(): void
{
// Shorthand for $this->setFiltersStatus(true)
$this->setFiltersEnabled();
}
Disable filters for the component.
public function configure(): void
{
// Shorthand for $this->setFiltersStatus(false)
$this->setFiltersDisabled();
}
Enabled by default, show/hide the filters dropdown.
public function configure(): void
{
$this->setFiltersVisibilityStatus(true);
$this->setFiltersVisibilityStatus(false);
}
Show the filters dropdown for the component.
public function configure(): void
{
// Shorthand for $this->setFiltersVisibilityStatus(true)
$this->setFiltersVisibilityEnabled();
}
Hide the filters dropdown for the component.
public function configure(): void
{
// Shorthand for $this->setFiltersVisibilityStatus(false)
$this->setFiltersVisibilityDisabled();
}
Enabled by default, show/hide the filter pills.
public function configure(): void
{
$this->setFilterPillsStatus(true);
$this->setFilterPillsStatus(false);
}
Show the filter pills for the component.
public function configure(): void
{
// Shorthand for $this->setFilterPillsStatus(true)
$this->setFilterPillsEnabled();
}
Hide the filter pills for the component.
public function configure(): void
{
// Shorthand for $this->setFilterPillsStatus(false)
$this->setFilterPillsDisabled();
}
Set the filter layout for the component.
public function configure(): void
{
$this->setFilterLayout('slide-down');
}
Set the filter layout to popover.
public function configure(): void
{
$this->setFilterLayoutPopover();
}
Set the filter layout to slide down.
public function configure(): void
{
$this->setFilterLayoutSlideDown();
}
The following methods are available on the filter object.
By default, the filter pill title is the filter name, but you can make it whatever you want:
SelectFilter::make('Active')
->setFilterPillTitle('User Status')
If you have numeric, or generated keys as your filter option values, they probably don't look too nice in the filter pill. You can set the values to be displayed in the filter pill:
SelectFilter::make('Active')
->setFilterPillTitle('User Status')
->setFilterPillValues([
'1' => 'Active',
'0' => 'Inactive',
])
->options([
'' => 'All',
'1' => 'Yes',
'0' => 'No',
])
Now instead of Active: Yes
it will say User Status: Active
If the filter takes any config options, you can set them with the config
method:
DateFilter::make('Date')
->config([
'min' => '2020-01-01',
'max' => '2021-12-31',
])