Hi,
I’m trying to build an agenda tool for a conference where users can save their favourite sessions using velo. Unfortunately, I could’t manage to populate a table within a repeater. It is needed to show the speakers of the different sessions, please cf. (and please ignore the ugly colors ;)):
The speakers are part of each session in the collection via a multiference field which is linked to the speaker collection. This is the code I have so far in this function that populates the repeater:
function populateList($item, wishlistItem) {
// Get the wishlist session
let session = wishlistItem.session;
// is that a good way to get the speakers data?
let speakers = wixData.query("Sessions_new")
.eq("title", session)
.include('speakers')
.find();
// and now what?
$item('#name').text = session.title;
...
}
Can anyone give me – a js noob, obviously – a hint on how to approach this challenge? Thanks for your help!
Update: I now managed to populate the table with data using this code:
wixData.queryReferenced("Sessions_new", session._id, "speakers")
.then((myResults) => {
if (myResults.items.length > 0) {
let speakers = myResults.items;
console.log(speakers);
$item("#table1").rows = speakers;
} else {
console.log("No results found.");
}
})
But it’s not doing it reliably, I guess, it’s a timing problem? Any hint appreciated!