FilamentF
Filament2y ago
16 replies
Jon Mason

refresh select after suffixAction completed

I need to refresh my select options after the suffix action is completed. How would I accomplish this? Maybe using afterStateUpdated()?

       Select::make('quickbooks_vendor_ref_id')
                ->required()
                ->label('Vendor')
                ->options($this->getVendors())
                ->live()
                ->preload()
                ->searchable()
                ->loadingMessage('Loading vendors...')
                // ->afterStateUpdated() <--maybe use this to get the drop down to rerender after force refresh.
                ->suffixAction(
                    Action::make('refreshVendors')
                        ->label('Refresh Vendors')
                        ->icon('heroicon-o-arrow-path')
                        ->action(fn () => $this->getVendors(true))
                ),
Solution
use ->options(fn () => $this->vendors)
Was this page helpful?