F
Filament8mo ago
dyo

Problem with updated data in form repeater

how to directly trigger a property in form repeater to be updated, when the repeater was cloned or deleted in filament v2? I want to live calculate other property based on data in the repeater. for example, a property in repeater is called 'list_data' and calculated property is called 'sum'.
2 Replies
toeknee
toeknee8mo ago
->afterStateUpdated and loop through the repeater fields and re-calculate then set the values. use ->reactive() for v2.
dyo
dyoOP8mo ago
sorry, I forget to mention, that i'm using the repeater in custom page. i've tried using method updatedListData(), but it's not called when I cloned or deleted repeater's item. i've tried using with afterStateUpdated(fn($state) => dd($state)) on the repeater, to check if it's working, or with reactive(), still no luck. i've initialized the property list_data with public. what did I miss?
Want results from more Discord servers?
Add your server