#Selected records to widget

6 messages · Page 1 of 1 (latest)

green wing
#

I currently have a Stat widget dispalyed on a resource. Is there a way to pass in what records are selected via the checkmark on Bulk Actions to the widget?

The goal is to dynamically update the widget data based on the rows that are selected.

I've been playing around with this for a bit and haven't been able to figure it out. From my github searching, I found "livewire->getSelectedTableRecords()" might be useful here, but I'm not positive how to pass that to the Stat widget.

sturdy gardenBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

green wing
#

Well, I was able to get this working using broadcasting from the selected row up to the widget. Probably over complicated to accomplish this behavior -- but it's working! I still have an issue with my clickable rows that stop functioning if I apply a sort or search (Requires page refresh) I opened a separate help request on that one.

green wing
#

still plugging at this. I discovered I can add Livewire.dispatch to the core table.js file in vendor dir and it works great. So the question I'm struggling with now is how to create a custom table.js file that will overwrite the one pulled in from the composer package? I tried setting one up using FilamentAsset::register but it has no effect in overwriting the core function from there. 🤔

rigid pike
#

If it’s applicable maybe a PR to filament would be better than trying to override it, as long as doesn’t break anything else.

green wing
#

it just fires off a livewire dispatch when a record is checkboxed in the table.js. I don't really know what I'm doing here but it worked lol