Repeater action -> modal
Hey all
Feel like I live in this thread at the moment so I do apologise.
I have the following:
1) Estimate Edit Page with a repeater showing EstimatePrices. It shows a slimed version.
2) I want an action on the repeater item to open up the estimatePrices record so I can perform further relationship components and show more fields.
I cannot for the live of me figure out how to pass the repeater record model/collection in.
To clarify I want the record of the repeater passed in and not the main parent record.
Any help would be appreciated. Thank you.
18 Replies
thank yo. I was reading this. How would I pass it all through to a form on the modal though? I would have form componetns and another repeater ( relationship ) based off the data passed through
sorry if I'm missing it
Forgot to mention. I am using your TableRepeater if it makes any difference
when I use the likes of
`$itemData = $component->getItemState($arguments['item']);
it passes the array through but I cannot run relationships off of it or more data than is in teh parent repeaterYou might have to make another db query at that point to be able to act on it.
Table repeater still uses the native repeater class, it just uses a different view so all the functionality should still be the same.
do you know how one would pass a collection into the form though?I can obviously pass through an array of data but its the fact I need a collection / record to be passed through so I can run a repeater with a relationship off of it. thanks again
I essentially need an EditRecord action but on a repeater instead of a table
Hum. On my phone right now, so not going to be able to type a lot out. I would say to have a look at the CloneAction on the Repeater class itself. That might give you some more insight about how to access items themselves. Or the DeleteAction.
Good idea I'll take a look
Basically though. ‘Item’ in this context is going to be the uuid key of the item in the repeaters state so that can be used to get the data back out of the component state. Which will be an array of that repeater items state. So you could either collect that, or use its id or some other attribute to re-query the db to get it’s model instance with its relationships.
I could be misunderstanding the full use case too though.
I'll give it all another shot in the morning I think. Tired eyes and brain. thanks again
not as ideal but I think I can work with this now:
This pulls in the estimate_costs relationship info I can then send to the repeater on the internal modal
I’ll just need to manually sort out saving the record and its relationships which isn’t the end of the world
Thought you were going to bed. Lol.
Start with making it work first. Then worry about ideal.
I struggle going to bed when I have something unsolved. That’s good enough for me to go to sleep now haha. Only downside I can see is I am relying on a hidden field on the repeater to have the ID I need to then run the DB query filling the modal. I assume this may be able to be tampered with perhaps. Anyways it’s a step closer so thank you again.
And thanks for all the work you, been following you on twitter etc 👌🏻
And thanks for all the work you, been following you on twitter etc 👌🏻
Ok. I’m definitely misunderstanding then. There shouldn’t be any hidden field. But get some rest. Have a good one.
Thanks for following. I appreciate it.
Used the ID as a hidden field on the repeater so I could get the id of the db record. And then repopulate it on the action model
Can talk more after you’ve had some rest and I’m at a computer with an actual keyboard. 😂
Yea. This shouldn’t be needed. It’s all available on the component.
Maybe I’m missing it somewhere in there then. I did try to locate it. In short I simply need to mimic the EditAction on a table row but on a repeater ‘row’ instead. I was just struggling to find a way to grab said record and populate the form model when clicking the action
If it’s available in the component though I’ll have to take another look. I managed to get the array of data that exists visibly on the repeater but that’s not the db record itself of which I could then run further relationship components etc.
Anyway must go to sleep. Off on holiday with the family in the morning 🍻 thanks again
Yea. Feel free to hit me up tomorrow. And we can work through it.
Or when you’re back from holiday.