© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
Phuc Le

Count selected records in Table Builder Bulk Action form

This is my code:

BulkAction::make('action')
  ->icon('heroicon-o-cog-6-tooth')
  ->deselectRecordsAfterCompletion()
  ->form(function (Collection $records) {
      return [
          Placeholder::make('Cost Breakdown')
              ->content('Selected: ' . number_format($records->count()))
      ];
  }),
BulkAction::make('action')
  ->icon('heroicon-o-cog-6-tooth')
  ->deselectRecordsAfterCompletion()
  ->form(function (Collection $records) {
      return [
          Placeholder::make('Cost Breakdown')
              ->content('Selected: ' . number_format($records->count()))
      ];
  }),


This will count the total of selected records and show it in the placeholder. However, if I close the modal and select one more record, the count does not change. It seems that Filament caches the modal content in subsequent requests. How can I get the fresh count data every time the modal opens?
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Bulk Action: change "x records selected"
FilamentFFilament / ❓┊help
12mo ago
Limit max selected records on bulk table
FilamentFFilament / ❓┊help
3y ago
Records count in table header
FilamentFFilament / ❓┊help
2y ago
Accessing the selected records before firing a bulk action
FilamentFFilament / ❓┊help
13mo ago