Linking Between Table Views with a Filter Value
I am relatively new to Filament. I am wanting to create an action that will link from one Table Resource to another in filament, but I want to pass through a filter value in the link so the 2nd table resource is only showing the records that I want shown based on the filter I pass through. I can't see anywhere in the documentation about this.
Solution:Jump to solution
I think this should work:
```php
route('filament.admin.resources.event-survey-sections.index', [
'tableFilters' => [
'event_survey_id' => [...
11 Replies
Are are you creating the link from one table to the other?
Yes - trying to…
Sorry, I meant
How are you creating the link
, lolUsing an Action with a URL - I can create the route, but I cannot add the parameter with the filter value
Can you share the code you are trying?
Action::make('Show Survey Sections')
->url(fn(EventSurvey $record): string => route('filament.admin.resources.event-survey-sections.index', ['event_survey_id' => $record->id])),
The URL I need to end up with is admin/event-survey-sections?tableFilters[event_survey_id][value]=1 which is what I get when I manually filter the data - but I want to be able to create this link from an action in the "Event Survey" table rows...
Solution
I think this should work:
Or through the resource class:
You're a legend! i am almost certain that I tried the first option (which I am going to use), however clearly, I had something not hooked up correctly... Thankyou so much for your help...
I tried this, but ended up with an encoded URL that did not cause the trigger to work. Is this solution still working for you all?
This is what I get:
The encoded url isn't the problem. You should change
value
to search
. This should work
So