How do I get the index of a container in a repeater and change the color per container?
$item("#containerID").onMouseIn((event) => {console.log(event)});
What is it that you are trying to accomplish. What do you have so far? What works and what doesn’t? Share your code in a code block so that we can see what you are doing.
let arrayy = [a,b,c,d]
$w(“#repeaterfill”).onItemReady(($item,itemData,index=>{
$item (“#Title”). text= itemData . title ;
}
for(let i=0; i<arrayy.length;i++){
let fill = wixData.query(“ALL”)
.eq(“allid”,array[i])
Promise.all([fill.limit(1000).find()])
.then((res)=>{
let returned = [res[0].items].flat()
$w(“#repeaterfill”).container[i].backgroundcolor = “red”// trying to get something like this
$w(“#repeaterfill”).data[i] = returned[i]
})
}
@chidiejike Refer to the Repeater Documentation to see how to use Repeaters.
The Repeater is populated by using the data property, but you cannot modify the data array in-place using an index - $w(“#repeaterfill”).data[i] will not work.
The Repeater does not have a container property. Use the index parameter of the onItemReady() event handler to access each Repeater Item by it’s index (position) in the Repeater.