Is it possible to update a single item in a repeat only?

Hey all,

I have a few repeats that display a heap of data. Some is hidden until revealed by the user. What I’d like to do is update just that row in the repeat, instead of refreshing the entire repeat each time. Is this possible? Noting I do have unique keys on the repeat.

Matt

What sort of data source is the data coming from? A database query?

External API

From what I understand about how DMX/AppConnect works, when you use a repeat, only way to show updated data is to update the repeat source.
When you update the source - in this case API (client or server) - DMX only refreshes the DOM on the rows where data has changed. If there is no change in the source for say index 3, DOM remains the same.
I could be wrong, but this is what I have seen/undestood.

One HACK you could do is - update the API’s output JSON.
Since all data is stored in JSON on client side, once you have update any row’s data, and now have the updated field values just for that row, you can use JS to modify the JSON.
Eg: Let say data is stored in sc1.data.apiResponse. You could update it as dmx.app.data.sc1.data.apiResponse[3].somefield = "somevalue";, and you should see the UI with updated data.
I have just tested this once some time ago, and have never user it in production.

2 Likes

Ok, cool - thanks @sid for confirming - I’ve been refreshing the source, so I’ll keep with that approach at this point.