Rename 'single' Asset (repeater item) in Wix Studio, Not EVERY item (Bug or am I doing something wrong)?

Question:
[As of now Wix Studio is missing basic capability on repeater. I really want a hover repeater where when the the user click on a box, it change the image. For now I can accomplish this via code however when I change the name of a specific image in an item, it changes the name of ALL the images in all the item boxes of a repeater. How do I change the name of a single item in a box?]

Product:
[Wix Studio.]

What are you trying to achieve:
[I am trying to add code so that ‘onclick’ of a specific file image, it changes to that images ‘hover’ equivalent’. ]

What have you already tried:
[I’ve already skimmed the forums and tried basic troubleshooting.]

Additional information:

To make things simple:

Is there a way to ‘rename’ a ‘SINGLE’ element in a repeater without renaming ‘ALL’ of the elements the ‘SAME’ thing?

I have a repeater with 10 items and 10 different images, just need each image to have a different name so I can add code to do specific things when each item is selected.

Any help is greatly appreciated :slight_smile:

SkreenGG

Everything what is inside the repeater must be called with → $item <— inside the → onItemReady() —> you are using → $w <—

Please read REPEATER’S introduction, to understand how to work with repeaters.

There you will find several ways of how to work with repeaters.

I can’t see anything what is calling your repeater inside of your code.
If you think that just by connecting your repeater through your dataset and setting-up settings inside of the property-panel will do the job → then you are wrong.

Your code should look something like…

$w.onReady(()=>{
    $w('#myRepeater').onItemReady(($item, itemData, index)=>{
        console.log(itemData);
        console.log(index);
        console.log($item._id);
    });
});

Another option would be to use … (For a repeater populated by connecting it to a dataset)

$w.onReady( function () {
  $w("#repeatedContainer").onClick( (event) => {
    let $item = $w.at(event.context);
    let clickedItemData = $item("#myDataset").getCurrentItem();
  } );
} );

And do not forget about…

$w('#myDataset').onReady(()=>{.....});

Because for sure you are using a DATASET in your setup.

1 Like

Thank you very much @CODE-NINJA

In classic wix editor there is the ability to add a ‘hover repeater’ but I could not see that same option in Wix Studio. My end goal was simply have a repeater with images and when you click on one image it would change that image to a different image.

I could do it all via code by getting the image in the item but that’s the hard, long way around.

I finally figured out a quicker workaround

I simply added the ‘hover image’ to each repeater item and placed it behind the ‘front image’. I then added an ‘on-click appear-out interaction’ on the front image. So when anyone click on the image, it disappears and the ‘hover’ or image behind it shows up. It seems to accomplish my end goal :slight_smile:

In the future, hoping there is a way to rename a single element in a repeater to give it a unique name (will help me when coding very specific things)


https://alvingwallace.wixstudio.io/skreen | still very pre-alpha

Thank you so much for your help Sir. It got my brain fired up to think of a creative solution

SkreenGG