Help with URL Query Parameters for Table Modal Actions in Filament
I'm working on a project, and I have a specific requirement where I need to attach a URL parameter to a table modal action. My goal is to have the modal behave like it’s controlled by URL query parameters. Here’s the detailed functionality I’m aiming for:
1. Open Modal with URL Parameter: Whenever a link with a specific URL parameter is opened, the modal should automatically open. For example, if the URL is https://example.com/page?openTransactionId=123, it should open the modal corresponding to transactionId = 123.
2. Persist Parameter: The URL parameter should persist every time the modal closes and reopens within the same session.
3. Remove Parameter on Close: When the modal is closed, the URL parameter should be stripped off.
9 Replies
Example of what I'm looking for but imagine the url param is linked to the opening and closing of the modal.
Right now I'm just using a script to intercept the record id across pages by storing it in local storage
And using mountTableAction
did you figure this one out? I found the code once but I cant for the live of me find it again
I don't think you can manipulate the url directly and only by a redirect? So unsure how you would acheive that. The modal should be acheivable by triggering it in JS
I figured it out for my use case. I have a URL action on another table which I wanted to direct to a new page which contains a table and open the relevant edit action modal for a specific record.
Not sure if that is in the docs anywhere but it would be handy
Doesn't appear to be, feel free to do a PR
Funny.. I just need to use that!
It’s really handy. I knew it was possible, just not what the url parameter names needed to be. Got there in the end through trial and error
Yeah I did the same thing. Wasn’t able to persist it anytime the modal is open, but for my use case I just needed to redirect and open.
same