Make select re-render after changing data

How can I make this select refresh it's options after the user clicks the refresh button:
Select::make('quickbooks_vendor_ref_id')
->required()
->label('Quickbooks Vendor')
->options($this->getOptions())
->live()
->preload()
->loadingMessage('Loading vendors...')
->suffixAction(
Action::make('refreshVendors')
->label('Refresh Vendors')
->icon('heroicon-o-arrow-path')
->action(fn () => $this->getOptions(forceRefresh: true))
),
Select::make('quickbooks_vendor_ref_id')
->required()
->label('Quickbooks Vendor')
->options($this->getOptions())
->live()
->preload()
->loadingMessage('Loading vendors...')
->suffixAction(
Action::make('refreshVendors')
->label('Refresh Vendors')
->icon('heroicon-o-arrow-path')
->action(fn () => $this->getOptions(forceRefresh: true))
),
5 Replies
Tieme
Tieme12mo ago
Why refresh? Does this select depends on a other field to be populated?
Jon Mason
Jon MasonOP12mo ago
the select has a suffix action that, when clicked, fetches data from an external api. Once the data is fetched, I want to select to reflect the changed data.
Čamap
Čamap8mo ago
Have you found solution to this? @Jon Mason
samran2000
samran20008mo ago
kindly read this :- https://filamentphp.com/docs/3.x/panels/pages#refreshing-form-data I think you need to replace 'Status' with 'quickbooks_vendor_ref_id' i don't know the exact answer but I think this will work
Jon Mason
Jon MasonOP8mo ago
I haven't figured this out yet, I'll check out the link.
Want results from more Discord servers?
Add your server