How to open a filament modal using dispatch?
I have a page, that renders a table with a custom column:
Main.php
Within the custom column blade file, I have the following code:
CustomColumn.blade.php
Click the
<td>
should open the global-modal
component. Here is how it is defined:
GlobalModal.php
global-modal.blade.php
But when I click the button, the dispatch does nothing. No error are shown either.
I have confirmed the button works, by placing a dd("hello")
in the handleOpenModal
function.
Could someone please assist where I am going wrong?1 Reply
Fixed it. I had to use
$this->dispatch('open-modal', id: 'global-modal');
and not $this->dispatch('open-modal', ['id' => 'global-modal']);