Hi –
I am trying to programmatically set the contents of a repeater. It is working fine except for the link on the images in the repeater. Based on a trace via the console I can see that the links are set correctly, they just aren’t being recognized. Am I missing something or is this a bug?
You can see the issue on my simple test site at https://bigenginespc.wixsite.com/test2 . It has two identical repeaters, the first built completely in the editor and the second built with wix code. If you look at the console you’ll see that the properties of both are identical, including link src, yet the links fire on the regular repeater but not the coded repeater.
Any suggestions would be much appreciated. Thank you!
The code looks like this:
$w.onReady( function () {
logRegularRepeater();
setCodedRepeater();
logCodedRepeater();
});
function logRegularRepeater() {
console.log("********** REGULAR REPEATER **********");
$w("#repeaterRegular").forEachItem(($item, itemData, index) => {
console.log(
“Index: " + index + “\n” +
“Label: " + $item(”#labelTextRegular”).text + “\n” +
“Image source: " + $item(”#shapeVectorRegular").src + “\n” +
“Image link: " + $item(”#shapeVectorRegular").link + “\n” + “\n”);
});
}
function setCodedRepeater() {
const codedRepeaterData = [
{
“_id”: “item1”,
“labelText”: “First Item”,
“shapeSource”: “wix:vector://v1/8463f60718194af748c49dddbe45b668_svgshape.v1.HollowCircle.svg/8463f60718194af748c49dddbe45b668_svgshape.v1.HollowCircle.svg”,
“shapeLink”: “/page-1”
},
{
“_id”: “item2”,
“labelText”: “Second Item”,
“shapeSource”: “wix:vector://v1/9cca9e9c03ec45e28cb046998aedd32d.svg/Triangle.svg”,
“shapeLink”: “/page-2”
},
{
“_id”: “item3”,
“labelText”: “Third Item”,
“shapeSource”: “wix:vector://v1/909695c1e003409ba70b5561666c7c4d.svg/Square.svg”,
“shapeLink”: “/page-3”
}
];
$w("#repeaterCoded").data = codedRepeaterData;
$w("#repeaterCoded").forEachItem(($item, itemData, index) => {
$item("#labelTextCoded").text = codedRepeaterData[index].labelText;
$item("#shapeVectorCoded").src = codedRepeaterData[index].shapeSource;
$item("#shapeVectorCoded").link = codedRepeaterData[index].shapeLink;
});
}
function logCodedRepeater() {
console.log("********** CODED REPEATER **********");
$w("#repeaterCoded").forEachItem(($item, itemData, index) => {
console.log(
“Index: " + index + “\n” +
“Label: " + $item(”#labelTextCoded”).text + “\n” +
“Image source: " + $item(”#shapeVectorCoded").src + “\n” +
“Image link: " + $item(”#shapeVectorCoded").link + “\n” + “\n”);
});
}