Run Action from Javascript.
Unfortunately cant just use wire:click since this is within javascript, so im forced to use a Livewire:emit and then my listener looks like so . Now the problem is that the action isnt actually used anywhere on the page, which i think is part of the problem. I know its not as simple as returning my actual action with the record as that doesnt actually execute it. I think im close. But missing something simple.
6 Replies
Seems a little dirty, but this appears to work. Well kinda, its launching it, but I think im getting some conflict that the modal isnt showing. I have filament modals in my blde though. At least progress though and definitely open to improvements
hmm, looking at the html source, it may or may not have created multiple modals and why i am only seeing the shadow affect over the page
I lied on the multiple modals. Must be related to other actions or something
woo hoo, got it
im still open to your suggestions for improvement though @Hugh Messenger
i saw you typing π
Can you explain a little more the "within javascript" part?
<script></script>
So not an Alpine component?
correct. bascially the "tooltip" that mapbox is generating has a setHtml() option and i can set some html in there, but thats all done through that javascript. I am going to feel dumb here if its possible, but i dont think i can setup alpine within it
My Maps widget has an example of mounting an action directly from JS using $wire.mountAction(). But there's some Alpine magic going on.
Or rather, Livewire magic.
But I have no idea how your component is structured, or how you use Mapbox.