Access repeater data afterSave
I have a relationship repeater and inside it there is also a checkbox that doesn't really exist in the model.
In the Edit Record Page I want to do some logic with all the items that had the checkbox checked after saving.
$this->form->getState() won't return any of the repeater data. Probably because it's a relationship repeater which disables dehydration from what I can tell.
And $this->data for some reason always returns false on the checkbox column even though it's checked. I'm assuming because it somehow, somewhere fetches/rehydrates the data from the relationship and since the column does not exist it gets null and else false.
So my question is how can access the original data or somehow get all the items that had this checkbox checked?
7 Replies
Did you find an answer to this one ?
where exactly do you need to access it from inside repeater or in anther component share you code
I think you'll struggle, you might be able to do it on the data on the afterCreate and then map the data accordingly.
I went for doing it after the Save in the end and mapping the data I needed. It needed to access it on another component. Eg a total price is the total of all repeater values.
Why not just sum the records?
maybe using this instead of afterSave() ?
I’ll give this a go later thank you.
I did also try having the repeater values sum after state updated but it was creating some lag and missed key strokes. Which is why I was hoping to perform the sum just before saving.
^