Skip to content

Changing of filter options based on a selected value from another filter. #2265

Closed Answered by mrl22
mrl22 asked this question in Q&A
Discussion options

You must be logged in to vote

For anyone else, I answered by using Livewire Hooks

    public $filterProject;

    public function mount(): void
    {
        $this->filterProject = request()->get('table-filters')['project'] ?? null;
    }

    public function updating($name, $value): void
    {
        if ($name === 'filterComponents.project') {
            $this->filterProject = $value;
            $this->setFilter('wall,_elevation,_floor,_zone', null);
        }
    }

    // FILTER

    // Wall, Elevation, Floor, Zone
    $filters[] = MultiSelectDropdownFilter::make('Wall, Elevation, Floor, Zone')
        ->options($this->builder()
            ->select('wall_elevation_floor')
            ->when($this->filterProject, 

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by mrl22
Comment options

lrljoe
May 9, 2025
Collaborator Sponsor

You must be logged in to vote
1 reply
@mrl22
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants