Grégoire
Handling dispatch events with named parameters in Filament Action
Hi 👋
I'm trying to dispatch a Wire Element Pro event to open a slide-over from within a reusable Filament action. While this works seamlessly when the action is defined within a Livewire component, it doesn't seem to work as expected in a Filament action.
Here’s the code that works well in a Livewire component:
However, when I try to achieve the same in a Filament action extended class, I encounter issues. Specifically, I believe the
dispatch
method from the CanDispatchEvent
trait differs from Livewire's HandlesEvent
logic, causing the following problems:
- Named Parameters: The first approach using named parameters (component: 'settings.team.switch-team-slide-over'
) results in an "Unknown named parameter $component" error.
- Array Syntax: The 2nd approach using an associative array doesn't throw an error, but it fails to trigger the slide-over event as intended.
I also realise that $this->js()
is not usable in this context either.
Is there a different method or workaround that would allow me to trigger the slide-over event in this context? 🙏9 replies
Issues with dynamic checkboxlist state in multi-step wizard form
Hi everyone,
I am trying to update a
CheckboxList
depending on the value of a field set in a previous step of a Wizard
form. The following code works fine and displays the CheckboxList
as expected. However, it seems that all the CheckboxList
boxes have the same state, so when I check one box, all the boxes are checked.
This seems to be related to how I pass the $get('user_id')
value from one step to another. If I hardcode the numeric id instead of the variable, everything works as expected.
If I add a debug at the beginning of the second step, I see that the query() is called multiple times, including when the document_id
is not set up yet, which is not really what I would expect either.
I am really confused as to how to approach the problem. What would you do?
EDIT: my message is too long to paste the code, so I shared it in the first reply.22 replies
Using refreshFormData() in static form methods
Hello everyone,
I am a little confused by the "Refreshing form data" part of the documentation. It states that if "you're using actions on an Edit or View resource page, you can refresh data within the main form" which is exactly what I want.
The example provided is:
The thing is that a resource page's
form
method is static, and therefore it is not possible to call $this->refreshFormData()
from within the action
method.
The obvious error (if someone searches by keyword):
What am I missing here?
I suppose there is a way to inject the property into the function?6 replies