I created a repeater from one of the templates which is the projects one. Now for each project item I want to add a couple tags and other stuff which are multi-references, one project can have many tags and a tag can be associated with many projects.
Basically, for the project item inside the repeater I want to start by adding a simple list of text with all it’s corresponding tags. How could I achieve this?
I’m a developer so I don’t have a problem with coding, it’s just so that I’m new to the wix platform, so I don’t know how to attach for example any scripts to an UI element inside a repeater so I can just loop through the multi-reference items and add a text element there
@dylanvelez Wix/Velo has built-in looping functions that allow you to assign values to repeater item elements: onItemReady and forEachItem , Here is a simple, crude example of how you would implement onItemReady. You could have a backend function called getProjects that queries the data using wixData.query. In the repeater, for the multi-reference field you might want to use a selection tag element or a checkbox group to display the values.
import {getProjects} from 'backend/datafunctions';
$w.onReady( async function () {
$w('#repeater').onItemReady(($item,itemData,index) => {
$item("#txtTitle").text = itemData.title;
let opts;
// loop through multi-reference field to create an array that can be assigned to the options property of the collection tag element. The multi-reference field will be in the query results represented by itemData if you use the include function for the multi-reference field in the backend query.
$item("#selTags").options = opts;
})
// query the data
let results;
results = await getProjects();
if (results){
// assign query results to the repeater's data property
$w("#repeater2").data = results.items;
}
});