@yisrael-wix updated the link to the minimal working example (MWE), also added a MWE for below snippet. Hope this will provide you with the necessary insight in my issues.
@yisrael-wix I resolved my issue by working with the existing indices (itemData._id) of the repeater. Renaming them is what causes problems (see my previous comment) - might want to communicate that to the teams.
Working prototype: https://thefashionsocietyh.editorx.io/website-11/page-3-mwe-new
var pos = Math.floor(nbItems/2);
$w("#repeater1").forEachItem(($item, itemData, index) => {
console.log(index);
console.log(itemData._id);
console.log($item("#box217"));
//if(index < obj_cp[0].Colors.Eye.length){
$item("#box217").style.backgroundColor = obj_cp[0].Colors.Eye[index];
$item("#box217").style.borderWidth = "4px";
if(index === pos) {
$item("#box217").style.borderColor = "rgb(0,0,0)";
} else {
$item("#box217").style.borderColor = "rgb(255,255,255)";
}
//}
});
var item;
var firstColor;
$w("#button156").onClick( (event) => { //switch position of colors
$w("#repeater1").forEachItem(($item, itemData, index_i) => {
if(index_i === 0){
firstColor = $item("#box217").style.backgroundColor;
console.log("firstColor:")
console.log(firstColor)
$w("#repeater1").forEachItem(($item, itemData, index_j) => {
if(index_j < nbItems-1) {
//select item to the right
item = $w("#repeater1").data[index_j+1]._id;
console.log("nextItem:");
console.log(item);
var bgColor;
$w("#repeater1").forItems( [item], ($item, itemData, index) => {
bgColor = $item("#box217").style.backgroundColor
});
//current item
item = $w("#repeater1").data[index_j]._id;
console.log("currItem:");
console.log(item);
$w("#repeater1").forItems( [item], ($item, itemData, index) => {
$item("#box217").style.backgroundColor = bgColor;
});
}
});
//store first element in last pos
item = $w("#repeater1").data[nbItems-1]._id;
$w("#repeater1").forItems( [item], ($item, itemData, index) => {
$item("#box217").style.backgroundColor = firstColor;
});
}
});
});
Hey, really glad you worked that out. I went back and looked at your previous code. I completely missed the fact that you were modifying the IDs. That, as you have discovered, is a no-no.
@yisrael-wix the question is why. In my opinion that doesn’t make sense, even less if you do it in an ‘initiating’ loop. It’s just an object, so you should be able to change its properties. Also why is there a different result depending when you publish in preview vs. published?
@vervoortyves As stated in the documentation:
You cannot modify the data array in-place. To add, change, or remove objects from the repeater’s data array:
-
Store the value of the data property in a variable.
-
Make changes to the objects of the data array.
-
Reset the data property with the modified array.
Regarding your question about preview vs live: Preview and Live are currently rendered with different engines. Preview will eventually be rendered using the same engine as Live.
@yisrael-wix meanwhile I’ve re-written all my components (not updating ._ids anymore, only adding or removing them) and I just wanted to share that now both Preview and Live computed values are indeed in sync.
Live is however still not reflecting the changes in the UI, so any update on the point you made earlier?
“Seems that there is in fact an issue with the Repeater under the new rendering system. It’s still under evaluation to find exactly where the issue is.”
Implementation can be viewed at: https://www.thefashionsociety.eu/shoppingdestinations Try to add more than 4 items, then try to remove any item except for the first or the last one (still need to code this), and then add an additional item. You’ll see that it works fine in Preview, but not in Live.
Thanks!
@vervoortyves OK - I see the issue. I am referring this to QA for evaluation.
@yisrael-wix any updates on this one? Meanwhile see https://www.thefashionsociety.eu/brands for a similar example. Works fine in preview, but issues in published version. Also here, the first or last item that was added cannot be removed yet.
@yisrael-wix another issue: when wixWindow . formFactor equals “Mobile” , text style is not rendered well either. In the editor I set text color to rgb(0,0,0) - black. When making adjustments on runtime e.g.:
$item("#text35").html = "<p style='color:rgba(0,0,0,0.25)'>"+$item("#text35").text+"</p>";
these are not reflected either. The opacity is not applied. This works fine when wixWindow.formFactor equals “Desktop”
Again, computed values look good. Can you please sort these things out with the team? It’s becoming too much in my opinion. Am I the only one stumbling upon these issues?
Hi @yisrael-wix . Any updates on this one? Thanks!
@vervoortyves I’ll check on this for you. (I assume that it’s still not working - correct?)
@yisrael-wix indeed, still not working.
@vervoortyves I checked with QA and the main issue that they’re having with this is the complexity of the code.
It would greatly help expedite this issue if you can isolate the problem on a test page with an absolute minimum scenario. In other words, just the faulty Repeater with a minimum of code to reproduce the problem. This will help QA identify exactly what’s happening and where. They can then open a ticket with full details so the devs can fix it.
@yisrael-wix can we have a call to walk through the issue, or how do you wish to proceed? We’re not making any headways this way. Better I give a demo.
I spoke with QA and they need a minimum scenario in order to proceed. The page is not simple, and because of that it gets a lower priority. If you could create a page with a much simpler demonstration of the issue it will have a better chance of getting some attention. Otherwise, it will get fixed as work progresses.
@yisrael-wix OK, I’ll see what I can do. Thanks for your clear message, at least now I know where I stand. Still got some work on other parts of my website, so let me see when I can carve it out - maybe an idea to make a separate site for that.