I need to set the data for a specific data model from outside the targeted data model.
I’m guessing that I need to reference the specific data model in pageData, and use its setter to manually set the data.
A user clicks on a button within the data model and a modal window is opened, the user makes changes to the data and then when the modal window closes on its onClose event, I need to update the specific data model that sent the user to the modal window to begin with.
Could I please have some examples on how to do this?
Or is there a better way?
Mike
Hi @Michael_Kadron
Yes, you have access to data models from other data layers
here is a sample of two data containers, in each you can reset its data model or another
https://skilledhome.backendless.app/app/index.html?page=data_containers
Regards,
Vlad
Hey Vlad,
That’s not what I said,
Let me explain a bit more.
I need to target a specific data model (of many that are named the same) inside a repeater.
When the specific data model is clicked, I’m setting a reference to it in pageData.
When a modal window closes, I need to update that specific data model with the updated data.
How do I target that specific data model to update it’s data?
Some examples would be great.
I’m also unclear on how to get the UID from the set reference in pageData.
Thanks!
Mike
you need to replace the list item data with the new one in the list data that your repeater is binding to.
For example:
- you a list of items [{id:1}, {id:2} {id:3}]
- the list is used in the repeater
- when you opened a modal you get the item with id=1 and put (cloned) it to the pageData
- after changing the cloned data in the pageData you need to put it back to the repeater list data
- using the codeless block MapItems you create a new list with replaced item
- then you assign the list to the repeater