Dispatching a livewire modal from Action in a Table

Hello, i am trying to open a custom livewire modal from an action inside a table i have in a resource.

Action::make('modal_with_voucher_details')
    ->label('Show')
    ->modalHeading('Show')
    ->icon('heroicon-o-eye')
    ->color('gray')
    ->action(function ($record, $livewire ) {
      $livewire ->dispatch('openModal', 'livewire.test_modal',['record' => $record]);
    })

But when i click the action nothing happens. I was thinking maybe its because the modal needs the
@livewire('wire-elements-modal')

so that it can open, but i am not sure where i should add this so that it will work.

I have an admin page which has the resources and this resource i am mentioning above. I have also the front page which is in livewire and there the modals work as intented but i cannot make them work from inside the resource action in the admin panel.

Is there a workaround for what i need?
Was this page helpful?