filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
19.29k stars 2.96k forks source link

Extra footer actions are triggering a `MethodNotFoundException` #8595

Closed alexmanase closed 1 year ago

alexmanase commented 1 year ago

Package

filament/filament

Package Version

3.0.53

Laravel Version

10.23.1

Livewire Version

3.0.5

PHP Version

8.2.8

Problem description

I tried to create an action in the footer of an Action moodal, and it triggers MethodNotFoundException.

https://github.com/filamentphp/filament/assets/10696975/29798683-7d25-485b-ada7-41eb76d4a5ed

Here is the documenation section:

https://filamentphp.com/docs/3.x/actions/modals#opening-another-modal-from-an-extra-footer-action

Expected behavior

Trigger the action when pressing the button in the Action modal footer.

Steps to reproduce

  1. Clone the repository: https://github.com/alexmanase/filament-action-in-footer-issue
  2. Follow the instructions from README.md
  3. Open an "edit" modal
  4. Press the "Generate" button.

Reproduction repository

https://github.com/alexmanase/filament-action-in-footer-issue

Relevant log output

https://flareapp.io/share/x7XrLRRm
danharrin commented 1 year ago

Please use Filament\Tables\Actions\Action instead of Filament\Actions\Action

Child actions need to be the same class as their parent

alexmanase commented 1 year ago

@danharrin I just did it and now I get an error when I try to use $set:

Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization

I also updated the demo.

danharrin commented 1 year ago

$set is part of the forms package, not the tables package. What are you trying to do?

alexmanase commented 1 year ago

I want to change the value of the name input from the modal.

This one:

image
danharrin commented 1 year ago

that's gonna be tricky, probably $this->mountedTableActionsData['edit']['name'] = 'new value', which isn't very clean

alexmanase commented 1 year ago

This one worked for me:

$this->mountedTableActionsData[0]['name'] = 'New generated content';

It's enough for me.

Thank you for your help!