Can an action from a table call an event inside a widget?
Hey all, I am currently working on a system where I have a resource called assetResource. On the ListAssets page I have a widget that shows a map using a mapping tool. This mapping tool can highlight/target a locations using an id. I want it so that whenever I click on the asset in the table or perform an action for an asset, the map highlights/targets the location on the map. So my question is, what is the best way to implement this?
If anything is not clear, or if any code is needed please let me know.
3 Replies
Try to add an action which dispatch event with an argument, and add a listeners in that widget. In the end, it's all Livewire.
Try the terms like
ExposesTableToWidgets
and InteractsWithPageTable
Docs: https://filamentphp.com/docs/3.x/panels/resources/widgets#accessing-page-table-data-in-the-widget
Our article about it: https://laraveldaily.com/post/filament-stats-widgets-above-table-auto-update-with-filtersTy for this sugestion, I have created an action with a livewire dispatch event like this:
Then in my widget the following function:
and finally a listener in the blade file