Pass form data (`$state`) to `ChartWidget` in resource Create page
I have embedded a
ChartWidget
in a resource Create page (of type CreateRecord
) via the getFooterWidgets()
method.
Is there a way for the ChartWidget
to access the data in the form fields (e.g. via a $state
variable or similar) before the form is submitted (i.e. there is no record in the database table yet)?
What I'm trying to do is populate a chart after clicking a "Calculate" button (i.e. Action
) on the form and would appreciate any thoughts as to how to approach this.
Many thanks.Solution:Jump to solution
where are you using this action?
I think you will need to inject $livewire..
```php
->action(function($livewire) { ...
6 Replies
use livewire events
YourWidget
Your action
Thanks for your response @Leandro Ferreira
I get the following error "Using $this when not in object context", so would I need to pass a closure in as the 2nd argument to the
dispatch()
method?Solution
where are you using this action?
I think you will need to inject $livewire..
The action is defined in the
footerActions
of a form Section component.worked?
That's worked nicely - many thanks Leandro π