I’m currently constructing a repeater that uses data from a reference field. However, the repeater’s itemData field (used in functions like forEachItem and onItemReady) does not include any reference fields, only regular data like text and numbers. I’ve seen other instances where other people have made it work (such as this past post ), but I have not been able to accomplish this myself.
Currently, I’m implementing a hacky solution in which I query the DB from within my onItemReady callback, as so:
$w('#repeater1').onItemReady(async ($item, itemData, index) => {
// Need to perform query since references aren't part of itemData
// signups-4 is the name of the reference field
let result = await wixData.query("Pieces")
.eq('_id', itemData['_id'])
.include('signups-4').find();
// More code below
// ...
});
But I would like to see if a more elegant/efficient solution is possible.