Repeater's extraItemActions
method could accept a Closure and pass the current item into it
#10413
Replies: 4 comments 2 replies
-
Did you try it using ->mountUsing(function (Form $form, Model $record) {
$form
->fill(...)
->model($record);
}) |
Beta Was this translation helpful? Give feedback.
-
@MtDalPizzol hi did you get anywhere with this? I am working on the same type of thing but hit a brick wall |
Beta Was this translation helpful? Give feedback.
-
How to add value to ToggleButtons option?? Repeater::make('members') |
Beta Was this translation helpful? Give feedback.
-
For future reference, there is a way to get other values associated with the item the extraItemAction in Filament v3. By using the first bit of https://filamentphp.com/docs/3.x/forms/fields/builder#adding-extra-item-actions-to-a-builder to get the item state from the builder. Something like:
As the action get launched with the arguments that contain the UUID, so you can use the getState of the builder to get the Builder detail for that row then use however you need. Then you can save in the action using the latter end of https://filamentphp.com/docs/3.x/forms/fields/builder#adding-extra-item-actions-to-a-builder
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to add an extra action to repeater items.
Here's what I have:
Here's what would be better:
So, the point is that, currently, I couldn't find a way to set the model for the form in the scenario of a repeater. We are left with 2 options that are not ideal IMO:
Manually handle all the form data in the
->action
method, which seems a waste, since we could use the built in Filament awesomeness for simple jobs like that.Create a separate component for that form and handle it's open/closed state and current item being edited via events, which also seems a lot of extra job not really needed if we could use the approach I outlined above.
Beta Was this translation helpful? Give feedback.
All reactions