Table action, update record from within javascript.
In a resources table I need an action that interacts with a javascript library which uses data from the row record, and update that record back to the db.
Is a task that I don't know how to achieve, I think that has to be done interacting with the livewire object in js but I don't know how to pass the record to it and after the js interaction update it's fields back.
Specifically I'm trying to interact with the Metamask extension via the wagmi js library, and I need to use data stored in a table record, and after the interaction with Metamask I need to store the results back to the table row.
I think that the way is to create a custom action, but I can't find an example that depicts that scenario. Any idea? Thanks in advance.
1 Reply
You can dispatch an event from the table action, something like this:
If you're using Alpine.js, you can catch the event on the JS side like this:
You can bring the information back the other way (emit from JS, handle in PHP on the Page component)