Load page with filter
Hi
I would like to know if there is a method to load a filament page with a filter defined according to the link where you click:
On a page that lists missions, I need to redirect the user to a list of requests related to the mission they clicked on.
If you have an idea, I won't say no, thank you
16 Replies
what the difference between value and Filter_value ?
[value] is the name of the key, it needs to stay the same.
So for example for users:
https://mysite.test/mypanel/users?tableFilters[email_address][value][email protected]
and what does it look like on the code side?
Just build the filters as normal, no need to code anything else in.
so if my filter is :
The adresse_email table is a list of email like :
id email
1 hotmail
2 gmail
....
The user table is like :
id name email_id
1 toto 2
2 tata 1
....
so my url have to be :
https://mysite.test/mypanel/users?tableFilters[email_address][email]=hotmail
And now i will have a list of user who have a @hotmail
yea
h
Do you know where i can find the documentation for this ? That didn't work even though I did everything you told me
IT's simple, build the filter as normal, then filter. Your page url will now change with the filters in, copy those filters
But note, using a select you cannot filter by @hotmail.com you wouild need to filter by the exact value
if you want to search and not apply a filter, that's different you would use:
?tableSearch=tony%40hotmail
ensuring you have the column as searchable
nop my url didn't change, because i run my project with npm and artisan (in local)
You run a filament app with npm?
yes
i use "npm run dev" and "php artisan serve"
but also i use "npm run build" and "php artisan serve", my url didn't change when i put a filter
Will that's how it works.
anyway my url didn't change when i put my filter, do you have any idee ?
No, I've shown it above how it works. PRovide all your code if it's not working.