Hi there,
This topic discusses how to create a dynamic gallery if all the images are in the same row. This topic discusses how to add a photo gallery to a dynamic page.
I would like to use this technique for repeaters, but as a result all the containers display the same photos. I missed something, but I can’t understand what exactly… Any ideas?
$w(‘#dataset1’).onReady(() => {
var title = $w(“#dataset1”).getCurrentItem().title;
$w(‘#dataset2’).setFilter(
wixData.filter()
.eq(‘title’, title));
});
The gallery is connected to dataset2.
If the repeater contains only one item, this code works. If the repeater contains many items - photos are everywhere the same. There are no errors or messages. This code works fine on standard dynamic pages, however I want to show the photogallery in repeaters.
You actually need a combination of both forEachItem and Or’s last example code.
You will need to use Or’s example to find all the images before populating the repeater, creating an object with the urls. Urls in index 0 should match the first apartment, urls in index 1 should match the second one etc.
Once you have the object ready, you can populate the repeater using forEachItem.
Every time passing only the relevant urls from the previously made array using the ‘index’ variable given by the forEachItem function.
Hi,
You can find the documentation for repeaters here .
To populate a repeater by code first create the items object, pass to the repeater (repeater data ) and then populate it with forEachItem .
The code will not work since attaching galleries to repeaters is not possible yet. However you can implement a gallery-like element by adding multiple image elements to a repeater.
Hi All. Just a quick question, and sorry if its been asked before. With the repeater being limited to 1000 and if I set my dataset which is linked to said repeater to display only 20 items from many hundreds of items which the repeater could display, why is it that the repeater does not allow you to load another 20 items and display them like the standard grid display. I really do not want to set my Dataset to 1000 as its gonna take forever to load. Thanks in advance for any help
cheers