Can I update a repeater's data

I am using a repeater as a table and need to refresh the data in it in response to user action. The ids of the items in the repeater don’t change, just the data content. I’m ok with updating the elements in repeater, but my question is, can i update the itemData itself? I’ve tried this:

function refreshRptRinks(pIn){
$w(‘#rptRinks’).forEachItem( ($item, itemData, index) => {
let wItem = pIn[index];
$item(‘#inpVal’).disable();
$item(‘#txtVal’).text = wItem.val;
$item(‘#inpVal’).value = wItem.ord;
itemData.ord = wItem.ord;
itemData.val = wItem.val;
console.log(itemData._id, itemData.ord, itemData.val);
});
}
and the console output shows that this itemData is updated, but it appears that this does not get stored back into the repeater’s internal data i.e. next time I access that item, it shows the original data and not the updated values. Is this the specified behavior? I don’t want to clear down the repeaters data by #rptRinks.data =[], as this results in the grid flashing.

You have to call either API update():
https://www.wix.com/corvid/reference/wix-data.html#update
or save():
https://www.wix.com/corvid/reference/wix-data.html#save
to update repeater data.

My repeater is not connected to a collection. I feed it an array of objects. I can’t call these methods on the repeater or its elements.

If it is your own array object and you can not update it, it sounds a bug for me in your code.

I can update my own data array. What I cant seem to alter is the internal representation of that data in the repeater. In my code snippet, the last console output shows that the itemData record is updated as I require. However, I come out of that function and immediately enter another function (for testing purposes) to output the data of the repeater using another ForEachItem loop, and it shows the original data in the item record, not my updated one. I don’t detect any uncaught Promises in the logs either.

I’ve got round the issue now, by accepting that the itemData is immutable, but doesn’t cause an error if you do change it, and I’ve added another element to the $item and used that to store the data I need to be able to modify. It just makes the user interface more unwieldy to manage.

It would be nice if someone from Wix could confirm that this is the case.

It sounds to me you need to connect your repeater to a collection.

Just to finish this off for anyone viewing this. The API documentation clearly states how a data update is handled on a repeater. If Corvid finds an item in the new input array with the same id as is already present in the repeater, then it is ignored. So one option for me, would be to create a new id for the updated item in the input array, which would result in the original data item being deleted in the repeater, and a new data item created. However, I needed the id’s to remain intact so not an option open to me. Only way around for me, was to use the repeater.forEach method and handle each item in the new input array individually. Works ok, but can be a little slow in some circumstances.