Custom Bulk Action Select

Hello all! is there any way I can have the checkbox only to the row which has the device price as shown in the image? I want bulk action to work only to those rows
18 Replies
LeandroFerreira
You can get only the selected items: https://filamentphp.com/docs/2.x/tables/actions#bulk-actions
BulkAction::make('delete')
->action(fn (Collection $records) => $records->each->delete())
BulkAction::make('delete')
->action(fn (Collection $records) => $records->each->delete())
Filament
Actions - Table Builder - Filament
The elegant TALL stack table builder for Laravel artisans.
toeknee
toeknee2y ago
He wants to conditionally show it... The only way I can think atm is really hacky and rendering some JS on the row that finds the closes checkbox and display:none it.
Lambertn33
Lambertn33OP2y ago
This is trick squint
toeknee
toeknee2y ago
I wouldn't define it as a trick as it's ugly as hell haha
Lambertn33
Lambertn33OP2y ago
sure!
Lambertn33
Lambertn33OP2y ago
@toeknee_iom now i want to change the logic and make the Transfer selected action only visible if all selected items have device price
Lambertn33
Lambertn33OP2y ago
is it possible this time?
toeknee
toeknee2y ago
Hmm why not condition the action instead? Try moving and notify of failed where no price
Lambertn33
Lambertn33OP2y ago
I saw this🤗
Lambertn33
Lambertn33OP2y ago
and this automatically hides the checkbox as I wanted! thank you @toeknee_iom @Leandro Ferreira
LeandroFerreira
Nice! I ditn't know 👌
Lambertn33
Lambertn33OP2y ago
But think we have still to adjust something because there is still the message saying "select all"!
toeknee
toeknee2y ago
Me neither 🙏 You can select all, but then I believe it deselects them if the condition isn’t met?
Lambertn33
Lambertn33OP2y ago
Lambertn33
Lambertn33OP2y ago
still there is this option which I still want to hide
toeknee
toeknee2y ago
Ifg you select all what happens
Lambertn33
Lambertn33OP2y ago
It acts like normal
toeknee
toeknee2y ago
Sound correct to me, tick all for all applicable and select all for all. if you think it's a bug please create a bug issue on github 🙂
Want results from more Discord servers?
Add your server