Hey everyone, I have a complex issue with my selection dialog. I hope I can explain it in 3 steps:
- I have an action button in a form, that opens a modal. This Modal contains a custom table via table builder to select a record, that should be used to pre-fill the form.
- For this, each table record, has a "Select" button. Clicking on this button dispatches an event to pass the data down to the form.
- The problem: The event is dispatched (can see it in Debug bar), but it does not reach the form or any function outside the Livewire class.
The form:
Tabs\Tab::make('Import')->schema([
Actions::make([
SelectProductAction::make('select_product'),
SelectShippingAction::make('select_shipping'),
]),
]),
The modal action
class SelectProductAction extends Action {
public static function getDefaultName(): ?string {
return 'selectProductAction';
}
protected function setUp(): void {
parent::setUp();
$this->label('Select Product');
$this->modalHeading('Select Product');
$this->modalSubmitAction(false);
$this->modalCancelAction(false);
$this->modalFooterActions([]);
$this->modalContent(function (SelectProductAction $action): View {
return view('filament.actions.select-product-modal-content', [
'selectProductTable' => SelectProductTable::class,
]);
});
$this->action(fn ($data, $value, $state) => dd($data, $value, $state));
}
#[On('fooBarEvent')]
public function onFooBar($data): void {
// DOES NOT RECEIVE THE EVENT !
dd("On fooBarEvent", $data);
}
}