MrOlon
MrOlon
FFilament
Created by MrOlon on 10/28/2023 in #❓┊help
Selected option's label does not update in select field
What I am trying to do: I'm trying to change the options of a select field dynamically based on another field's value (a TextInput field). What I did: I pass a closure to the options method of the select field returning the new options based on another fields' value read with $get. The other field has live() (and, I don't know if relevant, native(false)). My issue/the error: The select's options are correctly updated: after changed the value of the text input field, opening the select I see the expected new options.
The options generated by the closure are always the same two options with the same key/id but with a different label. The issue is that the label of the selected option does not update when the options' labels change, but only when I click the select field to see the options. I think this is an expected behaviour due to the fact that the select's state does not actually change and the component's refresh happens only when the select field is clicked and the options are refreshed. Is there a way to trigger an update even if the state is the same? Thank you in advance!
2 replies
FFilament
Created by MrOlon on 6/22/2023 in #❓┊help
Multiple submit buttons in Action's modal
Hello! Is it possible with Filament admin panel to have multiple submit buttons in an Action's modal with different "values" to trigger different behaviors in the actual action closure? Some context: I have this Action on a table with a custom modal. In the action Closure I would access the submit "value" or some other info to determine which action to perform:
Action::make('my_action')
->modalContent(function (/* ... */) {
return view(/* ... */);
})
->form([
/* ... */
])
->action(function ($data) {
// Can I know here what submit was pressed? <---
// keep_first or keep_last?
})
->modalActions([
\Filament\Tables\Actions\Modal\Actions\Action::make('keep_first')
->submit(),
\Filament\Tables\Actions\Modal\Actions\Action::make('keep_last')
->submit(),
]),
Action::make('my_action')
->modalContent(function (/* ... */) {
return view(/* ... */);
})
->form([
/* ... */
])
->action(function ($data) {
// Can I know here what submit was pressed? <---
// keep_first or keep_last?
})
->modalActions([
\Filament\Tables\Actions\Modal\Actions\Action::make('keep_first')
->submit(),
\Filament\Tables\Actions\Modal\Actions\Action::make('keep_last')
->submit(),
]),
^ with this I'm able to show two different buttons which can submit the form but I don't know how to know which one was pressed Thanks in advance!
5 replies