How to call action from js?
I have a custom script in a custom filament page.
Inside of it, when something happens, i want to open an action.
I'm trying:
but i get:
Uncaught ReferenceError: mountAction is not defined
this is the action, and if i click it's button, it triggers it and the modal gets opened. so i just wanna call the method that opens the action modal via js:
5 Replies
i tried to check the docs
https://filamentphp.com/docs/3.x/actions/advanced#injecting-the-current-livewire-component-instance
to see if there is a way but cant find it so far
maybe
$wire.mountAction('createTask')
?VM38393:1 Uncaught ReferenceError: $wire is not defined
at <anonymous>:1:1
what im missing?
i just called it in the browser js console
Laravel
JavaScript | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
now i just tried to add it in the script instead of via browser js console, same error
checking it out now yeah, but idk how to call the
mountAction
method yet, ill keep seraching
is mountAction is a function of the livewire component? and i pass in an argument which is the action name
cant use $wire
in this particular script, cuz is inside a wire:ignore
i've finally achieved it. now i have different 2 scripts
one inside the @script @endscript
so it can access $wire
and the other one in the wire ignore so the feature can work
omg kinda tricky
but works
thanks y'all!