Persistent bulk action
Hi,
How to display bulk actions even if no row is selected?
I know I can add them in header actions, but they dont look nice on right side above search.
thanks
5 Replies
You can't, it sounds like you want header actions which are not selection relative
You can place bulk actions as header actions without issue, they will be disabled until u select a record.
What I need is to show buttons in the bulk action row, header actions are rendered above the search bar and look ugly
>sounds like you want header actions
I whant existing bulk actions to be rendered even if row is not slected, it will be disabled until I select a record
That is not possible out of the box. You will need to add custom css:
.fi-ta .fi-ta-actions {display:inherit !important;}
But then the problem you will have is, you will want each action to alert that nothing is selected. So really you need to create a PR to add support for always showing bulk action actions if Dan would accept it.
@Vitali Kartsivadze I solved this using a render hook. I display a disabled "bulk actions" button and then hide it whenever records are selected.
Here is how I'm doing it. You could adapt this to your own use case:
AppServiceProvider:
disabled-bulk-actions.blade.php:
Thanks for sharing. I solved it by publishing filament table views and implementing persistency checks in the blade file.
When I need persistent bulk actions, I add a property to the list record class of resource.
@if ((! $isReordering) && count($bulkActions))
<x-filament-tables::actions x-data="{ persistent: {{ $persistentBulkActions }} }"
:actions="$bulkActions"
x-cloak="x-cloak"
x-show="selectedRecords.length || persistent"
/>
@endif