Entangle table selectedRecords?

Is there a way of making a table's selectedRecords entangleable? I really do not want to overwrite the big tables/index file when I only need to change one line in it. The use case is where I'm using a table as a selection, so need a way of preselecting the selectedRecords.
8 Replies
Dan Harrin
Dan Harrin2y ago
I would avoid entangling, it will really slow the page down when you select lots of records. Thats why we dont use it
gizmojo
gizmojoOP2y ago
Ok but how do you get the selectedRecords without it? E.g I've got a button below a table.
{{ $this->table }}
<x-filament::button
type="button"
x-on:click.stop="$wire.addSelectedRecords(this.selectedRecords)"
>
{{ $this->table }}
<x-filament::button
type="button"
x-on:click.stop="$wire.addSelectedRecords(this.selectedRecords)"
>
Bulk actions are too hidden away and the primary use of this table is to select records. I've got this to enable the selection without bulk actions
public function isTableSelectionEnabled(): bool
{
return true;
}
public function isTableSelectionEnabled(): bool
{
return true;
}
toeknee
toeknee2y ago
Can you example what you are trying to do?
gizmojo
gizmojoOP2y ago
Use a table checkboxes for selecting many records. Here it opens a modal with the ability to sort/filter/etc.
gizmojo
gizmojoOP2y ago
When you click 'Select Animals' button at the bottom I need the selectedRecords but this is outside of the table component.
toeknee
toeknee2y ago
Yeah that's a bit tricky and I'm not sure how to handle it. I know LW3 is allowing passing data to parents so what could be handy in that scenario.
gizmojo
gizmojoOP2y ago
Awesome can't wait to get stuck into v3 just holding off it for now till they've released it. As a work around for now I've ended up overwriting the bulk action dropdown
gizmojo
gizmojoOP2y ago
Now to see if there's an easy of way of making the row on click toggle the checkbox.
Want results from more Discord servers?
Add your server