Make bulk action reactive to selection
Is it possible to check the selection to make a bulk action disabled/enabled?
For example, if there are rows in selection do not have 'tracking_number', the 'Send' bulk-action is disabled
6 Replies
Filament
Actions - Table Builder - Filament
The elegant TALL stack table builder for Laravel artisans.
Thanks for your help. But this is another case, I want to disable the action, not the select box. Because I have several bulk actions and one of them need additional criteria to make it enabled
I hope there is ->disabled(fn ($records) => // check each record)
To remove the selection per record you can use:
https://filamentphp.com/docs/2.x/tables/actions#disabling-record-bulk-actions
To disable the bulk action in checked the records do:
For example
Filament
Actions - Table Builder - Filament
The elegant TALL stack table builder for Laravel artisans.
Well, it looks work but not visually disabled, and to make it from disabled to enabled after changing selection, I need two clicks for that action to work again (first click it still disabled, second click already enabled and work), I guess it was to update the state from the server
The clearer effect can be seen using hidden
Not quite sure I follow. You could also the extraAttributes method too.
Alright thanks anyway...
I've found the alternative using disabledForm... feels more informative than disabled the action itself