Selected records to widget

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.
4 Replies
pepperoni dogfart
pepperoni dogfartOP•4mo ago
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.
No description
pepperoni dogfart
pepperoni dogfartOP•3mo ago
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. 🤔
awcodes
awcodes•3mo ago
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.
pepperoni dogfart
pepperoni dogfartOP•3mo ago
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 there's probably a better way to do it, or a more thorough method for sure
Want results from more Discord servers?
Add your server